import { EventTarget as Ie, Assets as Ct, Link as x, Node as k, EventBase as we, RectPosition as b, EllipseNode as wt, Cursor as w, AnchorProxy as Lt, AnchorUsageType as et, FunctionName as A, Point as nt, NDCAnchor as Le, NEHelper as F, NE as ke, Rectangle as be, Layer as kt, ResourceSystem as ce, StageMode as Te, NodeHelper as me, Shape as Ee, RegSystem as he } from "@jtopo/core";
import { PopupMenu as Pe, InputTextfield as Ae, Tooltip as He } from "@jtopo/extensions";
function $(n, t) {
  const e = Tt();
  return ($ = function(s, i) {
    return e[s -= 410];
  })(n, t);
}
const at = $;
function Tt() {
  const n = ["touchStartHandle", "stage", "20619588KmBarA", "clientX", "270162SuIlcz", "preventDefault", "parentNode", "120TJWdzT", "none", "addEventListener", "getDragItem", "black", "4904180MSASLD", "133IBcFru", "height", "appendChild", "style", "201246KYOyjn", "2530398GJaxPX", "dargItem", "add", "white", "panelDom", "touchend", "touches", "hide", "4ZTptgh", "absolute", "innerHTML", "22wTTuch", "setAttribute", "editor", "draggable", "4008lxoLqu", "classList", "622QRAeCQ", "display", "drawToCanvas", "1509895RutrwK"];
  return (Tt = function() {
    return n;
  })();
}
(function() {
  const n = $, t = Tt();
  for (; ; )
    try {
      if (-parseInt(n(428)) / 1 * (-parseInt(n(430)) / 2) + -parseInt(n(413)) / 3 + parseInt(n(421)) / 4 * (-parseInt(n(433)) / 5) + parseInt(n(412)) / 6 * (-parseInt(n(447)) / 7) + -parseInt(n(441)) / 8 * (-parseInt(n(438)) / 9) + parseInt(n(446)) / 10 * (-parseInt(n(424)) / 11) + parseInt(n(436)) / 12 === 651497)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class sn extends Ie {
  constructor(t, e) {
    const s = $;
    super(), this.itemSize = 40, this[s(435)] = t, this.editor = e, this.panelDom;
    let i = document.createElement("div");
    return i.style[s(431)] = s(442), i[s(429)][s(415)]("jtopo_iconsPanel"), this.stage.layersContainer.appendChild(i), this.panelDom = i, this;
  }
  setConfig(t) {
    let e = this, s = this.panelDom;
    return t.items.forEach(function(i) {
      const o = $;
      let r = document.createElement("div");
      if (r[o(429)].add("item"), r[o(425)](o(427), !0), r.ondragstart = function(a) {
        e[o(414)] = i;
      }, s.appendChild(r), i.shape != null) {
        let a = document.createElement("canvas");
        a.width = e.itemSize, a[o(448)] = e.itemSize;
        let l = Ct.getShape(i.shape);
        if (l == null)
          throw Error("shape not exist: " + i.shape);
        Ct[o(432)](l, a, { size: 0.8 * e.itemSize, strokeStyle: o(445), fillStyle: o(416), padding: 2 }), r[o(410)](a);
      } else
        r[o(423)] = i.iconHtml;
      r.addEventListener("touchstart", function(a) {
        const l = o;
        a[l(439)](), e[l(414)] = i, e[l(434)](r, a);
      });
    }), this;
  }
  touchStartHandle(t, e) {
    const s = $;
    let i = t.cloneNode(!0);
    t.parentNode.appendChild(i);
    let o = e[s(419)][0], r = o[s(437)], a = o.clientY;
    const l = t.offsetLeft, c = t.offsetTop;
    i.style.position = s(422), i.style.zIndex = "1000";
    const d = function(u) {
      const g = s;
      let m = u.touches[0], f = m.clientX - r, v = m.clientY - a;
      i.style.left = l + f + "px", i[g(411)].top = c + v + "px";
    }, h = this, p = function(u) {
      const g = s;
      t.removeEventListener("touchmove", d), t.removeEventListener(g(418), p), i[g(440)].removeChild(i), h[g(426)].mockDrop(u);
    };
    d(e), t.addEventListener("touchmove", d), t[s(443)]("touchend", p);
  }
  [at(444)]() {
    return this.dargItem;
  }
  [at(420)]() {
    const t = at;
    return this[t(417)].style.display = t(442), this;
  }
  show() {
    return this[at(417)].style.display = "block", this;
  }
}
const P = pt;
function Et() {
  const n = ["getFolder", "draggable", "640168YVgqby", "className", "black", "folders", "stage", "3732362eMfJYl", "66px", "hide", "1,1", "fontFamily", "block", "getCtroller", "none", "是否可拖拽", "边框粗细", "color", "top", "节点属性", "newFolder", "gui", "onFinishChange", "水平对齐", "3907371UpLXMh", "find", "close", "31196GOSeuG", "showProperty", "46px", "square", "open", "__controllers", "线条粗细", "fontSize", "add", "property", "lineCap", "textPosition", "borderWidth", "60px", "butt", "bottom", "893680ctfXbx", "16px", "italic", "backgroundColor", "0px", "连线属性", "基础属性", "absolute", "44px", "getValue", "name", "原点位置", "scaleY", "attachTo", "update", "style", "图层属性", "18px", "onChange", "1,10", "type", "7133730DkHoiA", "setStyle", "64px", "keys", "position", "bold", "target", "height", "154mVntAh", "object", "fillStyle", "500352GrIxhz", "lineWidth"];
  return (Et = function() {
    return n;
  })();
}
function pt(n, t) {
  const e = Et();
  return (pt = function(s, i) {
    return e[s -= 494];
  })(n, t);
}
(function() {
  const n = pt, t = Et();
  for (; ; )
    try {
      if (parseInt(n(566)) / 1 + parseInt(n(530)) / 2 + -parseInt(n(547)) / 3 + parseInt(n(550)) / 4 + parseInt(n(510)) / 5 + -parseInt(n(521)) / 6 * (parseInt(n(518)) / 7) + -parseInt(n(525)) / 8 === 977304)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class rn {
  constructor(t, e) {
    this.editor = t, this.dat = e, this.gui = new e.GUI(), this.object, this.folders = {};
  }
  setCurrentObject(t) {
    const e = pt, s = this.editor, i = this.editor[e(529)];
    i.inputSystem[e(516)] = t, i.selectedGroup.removeAll().add(t), t instanceof x ? s.linkCtrlBox.attachTo(t) : t instanceof k && s.nodeResizeBox[e(502)](t), s[e(503)](), this[e(551)](t);
  }
  [P(551)](t) {
    const e = P;
    if (t == null)
      return;
    this.basic = { id: t.id || "", className: t.className || "", name: t.name || "", type: t[e(509)] || "", x: 1, y: 1, imageSrc: "", width: 1, height: 1, text: "", rotation: 0, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0, originPosition: "center", draggable: t[e(524)] };
    const s = this.editor.stage.styleSystem.currentTheme.getStyle(t[e(526)]) || {};
    this.style = { lineDash: null, backgroundColor: s[e(569)] || "", strokeStyle: s.strokeStyle || "black", fillStyle: s[e(520)] || e(527), color: s.color || e(527), borderWidth: s.borderWidth || 0, fontSize: s[e(557)] || 12, fontFamily: s.fontFamily || "楷体", lineWidth: s.lineWidth || 0, lineCap: "butt", globalAlpha: 1, fontWeight: s.fontWeight || "normal", textPosition: s[e(561)] || "cb", textBaseline: s.textBaseline || e(541), textAlign: s.textAlign || "center" };
    const i = this.basic, o = this.style;
    Object[e(513)](i).forEach(function(a) {
      if (t[a] != null) {
        let l = t[a];
        i[a] = l;
      }
    });
    let r = t.getComputedStyle();
    Object.keys(o).forEach(function(a) {
      let l = r[a];
      r[a] != null && (o[a] = l);
    }), this.object == null && (this[e(519)] = t, this.init()), this[e(519)] = t, this.setFolderValues(i, o), t.isNode && this.getFolder("节点属性") != null ? (this.getFolder("节点属性").show(), this.getFolder("连线属性").hide(), this.getFolder(e(505)).hide()) : this.getFolder(e(494)) != null ? (this[e(523)](e(494)).show(), this.getFolder("节点属性").hide(), this[e(523)](e(505))[e(532)]()) : this.getFolder("图层属性") != null && (this[e(523)]("图层属性").show(), this.getFolder(e(542)).hide(), this[e(523)](e(494))[e(532)]());
  }
  newFolder(t) {
    const e = this[P(544)].addFolder(t);
    return this.folders[t] = e, e;
  }
  getFolder(t) {
    return this[P(528)][t];
  }
  getCtrollerValue(t, e) {
    return this[P(536)](t, e).getValue();
  }
  [P(536)](t, e) {
    const s = P;
    return this.getFolder(t)[s(555)][s(548)]((i) => i.property == e);
  }
  setFolderValues(t, e) {
    Object.keys(this.gui.__folders).forEach((s) => {
      this.gui.__folders[s].__controllers.forEach(function(i) {
        let o = i.property;
        t[o] != null ? i.setValue(t[o]) : e[o] != null && i.setValue(e[o]);
      });
    });
  }
  init() {
    const t = P, e = this, s = this.editor, i = s[t(529)], o = this.basic, r = this.style;
    let a = { 实线: "", "虚线1,1": t(533), "虚线2,2": "2,2", "虚线3,3": "3,3", "虚线7,3": "7,3", "虚线3,7": "3,7", "虚线10,1": "10,1", "虚线1,10": t(508) }, l = { "10px": "10px", "12px": "12px", "14px": "14px", "16px": t(567), "18px": t(506), "20px": "20px", "22px": "22px", "24px": "24px", "26px": "26px", "28px": "28px", "30px": "30px", "32px": "32px", "34px": "34px", "36px": "36px", "38px": "38px", "40px": "40px", "42px": "42px", "44px": t(497), "46px": t(552), "48px": "48px", "50px": "50px", "52px": "52px", "54px": "54px", "56px": "56px", "58px": "58px", "60px": t(563), "62px": "62px", "64px": t(512), "66px": t(531), "68px": "68px" }, c = { 正常: "normal", 粗体: t(515), 斜体: t(568), 加粗斜体: "bold italic" }, d = { 默认: t(564), 圆形: "round", 矩形: t(553) }, h = { 上: t(541), 中: "middle", 下: t(565) };
    function p() {
      let T = this.property, B = this.getValue();
      e.object[T] = B === "" ? null : B, s.update();
    }
    function u() {
      const T = t;
      let B = this[T(559)], _ = this[T(498)](), Ce = e[T(519)];
      B == "lineDash" && typeof _ == "string" && (_ = _.split(",")), Ce[T(511)](B, _ === "" ? null : _), s.update();
    }
    const g = this.newFolder(t(495));
    g.add(o, "id")[t(545)](p).name("id"), g.add(o, "className").onFinishChange(p).name(t(526)), g.add(o, t(499)).onFinishChange(p).name("name"), g.add(o, "type").onFinishChange(p).name("type"), g.open();
    const m = this[t(543)]("图层属性");
    m.add(r, t(569))[t(507)](u).name("背景颜色"), m.open();
    const f = this[t(543)]("节点属性");
    f[t(558)](o, "text").onFinishChange(p).name("文字"), f.add(o, "x")[t(545)](p), f[t(558)](o, "y").onFinishChange(p), f.add(o, "width", 1).onChange(p).name("宽度"), f.add(o, t(517), 1).onChange(p).name("高度"), f.add(o, "scaleX", -3, 3, 0.1).onChange(p)[t(499)]("缩放X"), f[t(558)](o, t(501), -3, 3, 0.1).onChange(p).name("缩放Y"), f[t(558)](o, "skewX", -1, 1, 0.1).onChange(p)[t(499)]("斜切X"), f[t(558)](o, "skewY", -1, 1, 0.1)[t(507)](p).name("斜切Y"), f[t(558)](r, "lineWidth", 0, 10).onChange(u).name(t(556)), f[t(558)](r, "lineDash", a).onChange(u).name("虚实"), f[t(558)](r, t(562), 0, 10).onChange(u).name(t(539)), f.add(r, "fillStyle").onFinishChange(u).name("填充颜色"), f[t(558)](r, "strokeStyle")[t(545)](u).name("线条颜色"), f.add(o, "imageSrc").onFinishChange(p)[t(499)]("图片路径"), f.add(r, "globalAlpha", 0, 1, 0.1).onChange(u).name("整体透明度"), f.add(o, "originPosition", { 中心: "center", 左上: "lt", 上中: "ct", 右上: "rt", 左下: "lb", 下中: "cb", 右下: "rb" }).onFinishChange(p).name(t(500)), f[t(558)](o, "draggable", !0).onChange(p)[t(499)](t(538)), f.open();
    const v = this.newFolder(t(494));
    v.add(o, "text").onFinishChange(p).name("文字"), v[t(558)](r, t(522), 0, 100).onChange(u)[t(499)]("线条粗细"), v[t(558)](r, "strokeStyle").onFinishChange(u).name("线条颜色"), v.add(r, "lineDash", a)[t(507)](u).name("虚实"), v.add(r, t(560), d).onChange(u).name("末端样式"), v[t(558)](r, "globalAlpha", 0, 1, 0.1)[t(507)](u).name("整体透明度"), v.open();
    const L = this.newFolder("文本");
    L.add(r, t(534), ["sans-serif", "Arial", "宋体", "隶书", "楷体"])[t(507)](u)[t(499)]("字体名称"), L.add(r, t(557), l)[t(507)](u)[t(499)]("大小"), L[t(558)](r, "fontWeight", c).onChange(u)[t(499)]("粗细"), L[t(558)](r, "textPosition", { 中心: "center", 左上: "lt", 上中: "ct", 右上: "rt", 左下: "lb", 下中: "cb", 右下: "rb" }).onChange(u).name("位置"), L[t(558)](r, "textAlign", { 左: "left", 中: "center", 右: "right" }).onChange(u).name(t(546)), L[t(558)](r, "textBaseline", h)[t(507)](u).name("垂直对齐"), L.add(r, t(540)).onChange(u).name("颜色"), L.open();
    let z = this.gui.domElement;
    z.remove(), i.layersContainer.appendChild(z), z.style[t(514)] = t(496), z[t(504)].right = "-15px", z.style.top = t(570), z.style.zIndex = 1e3;
  }
  [P(554)]() {
    this[P(544)].open();
  }
  close() {
    const t = P;
    this.gui[t(549)]();
  }
  hide() {
    const t = P;
    this.gui.domElement[t(504)].display = t(537);
  }
  show() {
    const t = P;
    this[t(544)].domElement[t(504)].display = t(535);
  }
}
const Y = At;
function Pt() {
  const n = ["5459949jZmMIe", "cyan", "2WvGOIW", "14JJIftn", "964722hgkTub", "6960648DDdUQs", "gray", "#efefef", "363016khkLTv", "5ErSOsb", "rgba(0,255,255,0.9)", "1222400ulocmL", "rgba(0,0,0,0)", "35371980kKBOEF", "2592984DADTTa", "rgba(0,255,0,0.5)"];
  return (Pt = function() {
    return n;
  })();
}
(function() {
  const n = At, t = Pt();
  for (; ; )
    try {
      if (-parseInt(n(301)) / 1 + parseInt(n(292)) / 2 * (-parseInt(n(294)) / 3) + -parseInt(n(304)) / 4 + parseInt(n(299)) / 5 * (-parseInt(n(295)) / 6) + -parseInt(n(293)) / 7 * (parseInt(n(298)) / 8) + parseInt(n(306)) / 9 + parseInt(n(303)) / 10 === 700777)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
function At(n, t) {
  const e = Pt();
  return (At = function(s, i) {
    return e[s -= 292];
  })(n, t);
}
const I = { data: { localLastDocName: "topo_last_doc" }, connectPoint: { size: 14, style: { strokeStyle: "gray", fillStyle: "rgba(255,255,255,0.6)", lineWidth: 1, padding: 3 }, activeStyle: { lineWidth: 1, fillStyle: "rgba(0, 255,255, 0.9)", padding: 1 }, unActiveStyle: { lineWidth: 1, fillStyle: "rgba(255,255,255,0.6)", padding: 3 }, drawStartMinDistance: 7, drawStartDelay: 50 }, connectBox: { anchorDist: 7, nodeDist: 7 }, nodeResizePoint: { width: 13, height: 13, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: Y(297), padding: 1 } }, nodeRotatePoint: { width: 14, height: 14, style: { lineWidth: 1, strokeStyle: Y(296), fillStyle: "#efefef", padding: 1 }, rotateLineStyle: { strokeStyle: "gray", lineDash: [3, 3] }, rotateLineLength: 30 }, crossGuildLine: { styleH: { strokeStyle: "rgba(255,0,0,0.5)", lineWidth: 1 }, styleV: { strokeStyle: Y(305), lineWidth: 1 }, axisInfoStyle: { color: "gray", fontSize: 16, fillStyle: "rgba(0,0,0,0)" } }, linkCtrlPoint: { size: 7, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: Y(300), padding: 1 }, activeStyle: { globalAlpha: 0.2 }, unactiveStyle: { globalAlpha: 1 }, adjustStyle: { strokeStyle: "gray", fillStyle: "rgba(255,255,255,0.8)", lineWidth: 1, padding: 1 }, ctrlLinkStyle: { lineDash: [2, 2], lineWidth: 1, padding: 2 } }, dropBox: { style: { fillStyle: Y(302), border: "3px solid orange", lineDash: [5, 3], lineWidth: 1 } }, align: { gridSize: 25, minDistance: 5, alignLineStyle: { strokeStyle: Y(307), lineDash: [5, 2], lineWidth: 1 } }, operationTip: { enable: !0 } }, V = Mt;
function Ht() {
  const n = ["4979160gspmKI", "12326496ILGUQP", "3PuOeWj", "ArrowRight", "7087450IFBrvL", "110ipFIwe", "2056080euItWM", "ArrowLeft", "3071394BSmqsp", "7ShMqWu", "915216NPLKid", "Delete", "Escape", "MAC OS", "4838670FrhBnf", "ArrowUp", "Shift+v"];
  return (Ht = function() {
    return n;
  })();
}
function Mt(n, t) {
  const e = Ht();
  return (Mt = function(s, i) {
    return e[s -= 444];
  })(n, t);
}
(function() {
  const n = Mt, t = Ht();
  for (; ; )
    try {
      if (parseInt(n(450)) / 1 * (-parseInt(n(458)) / 2) + -parseInt(n(448)) / 3 + -parseInt(n(454)) / 4 + parseInt(n(452)) / 5 + parseInt(n(445)) / 6 * (parseInt(n(457)) / 7) + -parseInt(n(449)) / 8 + parseInt(n(456)) / 9 * (parseInt(n(453)) / 10) === 890485)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const H = navigator.userAgent.toUpperCase().indexOf(V(444)) != -1 ? "Meta" : "Control", ut = { CtrlOrCmd: H, CreateGroup: H, DropTo_leader: "Shift", Delete: [V(459), "Meta+Backspace"], Select_all: H + "+a", Select_invert: H + "+i", Cut: H + "+x", Copy: H + "+c", Paste: H + "+v", Save: H + "+s", Open: H + "+o", Undo: H + "+z", Redo: H + "+shift+z", Copy_style: "Shift+c", paste_Style: V(447), Move_up: V(446), Move_down: "ArrowDown", Move_left: V(455), Move_right: V(451), Layout_tree: "t", Layout_grid: "g", LocalView: "/", ResizeKeepAspectRatio: "shift", DrawLine: "l", Cancel: V(460), DisableNodeAlign: "Alt" };
function Bt() {
  var n = ["251DCZUgq", "5920640LVSBvd", "204463onQiTy", "1240140fprafj", "472actICR", "9119406QnnDYO", "266958PArTky", "6094772MPsaZh", "930rIJrTb", "12760SmGHKn"];
  return (Bt = function() {
    return n;
  })();
}
function xe(n, t) {
  var e = Bt();
  return (xe = function(s, i) {
    return e[s -= 473];
  })(n, t);
}
(function() {
  for (var n = xe, t = Bt(); ; )
    try {
      if (-parseInt(n(480)) / 1 * (-parseInt(n(479)) / 2) + -parseInt(n(473)) / 3 + parseInt(n(477)) / 4 + parseInt(n(481)) / 5 + parseInt(n(475)) / 6 + -parseInt(n(482)) / 7 * (parseInt(n(474)) / 8) + -parseInt(n(476)) / 9 * (parseInt(n(478)) / 10) === 933825)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class M extends we {
  constructor(t, e) {
    super(t, e);
  }
}
const D = gt;
function gt(n, t) {
  const e = Dt();
  return (gt = function(s, i) {
    return e[s -= 333];
  })(n, t);
}
function Dt() {
  const n = ["_anchorToLocalPoint", "25490MhAyYG", "ne_resize", "height", "preventDefault", "pointerupHandler", "pointermoveHandler", "_positionToLocalPoint", "5SxxntD", "adjustFixedDirection", "name", "point", "6kfeyaQ", "getTopObjects", "738QteNXX", "stage", "resize", "6221370xNTrTS", "334870PFZXpe", "26470452mmKbVo", "sw_resize", "updateMatrix", "5288087XMxskr", "nodeResizePoint", "editor", "60BogmeU", "dispatchEvent", "length", "isKeydown", "pointerenterHandler", "vec", "8JsfGFk", "2393105vWAeSA", "180561cmxhkS", "setCursor"];
  return (Dt = function() {
    return n;
  })();
}
(function() {
  const n = gt, t = Dt();
  for (; ; )
    try {
      if (-parseInt(n(362)) / 1 * (parseInt(n(333)) / 2) + parseInt(n(348)) / 3 * (-parseInt(n(340)) / 4) + -parseInt(n(358)) / 5 * (-parseInt(n(367)) / 6) + -parseInt(n(337)) / 7 * (parseInt(n(346)) / 8) + -parseInt(n(364)) / 9 * (parseInt(n(351)) / 10) + parseInt(n(347)) / 11 + parseInt(n(334)) / 12 === 588447)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Me = { lt: b.rb, ct: b.cb, rt: b.lb, rm: b.lm, rb: b.lt, cb: b.ct, lb: b.rt, lm: b.rm, center: b.center };
class Be extends wt {
  constructor(t, e) {
    const s = gt;
    super(), this.nodeResizeBox = t, this.editor = t.editor, this[s(365)] = this[s(339)].stage, this.selectedGroup = this.stage.selectedGroup, this.resize(I.nodeResizePoint.width, I[s(338)][s(353)]), this.setStyles(I[s(338)].style), this.name = e;
  }
  [D(356)]() {
    const t = D;
    let e, s = this.name;
    s == b.lt ? e = w.nw_resize : s == b.ct ? e = w.n_resize : s == b.rt ? e = w[t(352)] : s == b.lm ? e = w.w_resize : s == b.rm ? e = w.e_resize : s == b.lb ? e = w[t(335)] : s == b.cb ? e = w.s_resize : s == b.rb && (e = w.se_resize), this.editor[t(365)][t(349)](e);
  }
  _anchorToLocalPoint(t, e) {
    return t[D(357)](e);
  }
  dragHandler(t) {
    const e = D;
    let s = this.nodeResizeBox.editor, i = this[e(360)], o = this.selectedGroup[e(363)]();
    if (o[e(342)] == 0)
      throw new Error("selectedGroup.length is 0!");
    let r = o[0], a = r.getWorldTransform(), l = t.xInWorld, c = t.yInWorld, d = a[e(361)](this._anchorToLocalPoint(r, i)), h = l - d.x, p = c - d.y, u = a.invert()[e(345)]([0, 0], [h, p]);
    if (h = u[0], p = u[1], i == b.lt ? (h = -h, p = -p) : i == b.ct ? (h = 0, p = -p) : i == b.rt ? p = -p : i == b.lm ? (h = -h, p = 0) : i == b.rm ? p = 0 : i == b.lb ? h = -h : i == b.cb ? h = 0 : b.rb, s.keyboard[e(343)](ut.ResizeKeepAspectRatio) && (p = h * (r.height / (r.width || 1))), this.adjustFixedDirection(r, [h, p], i, a), h != 0 && p != 0 && s.hasListener("resize")) {
      let g = new M(e(366), { target: r, details: { dx: h, dy: p, ctrl: i } });
      s[e(341)](g);
    }
  }
  [D(359)](t, e, s, i) {
    const o = D;
    let r = Me[s], a = this[o(350)](t, r);
    a = i.point(a), t.resizeWith(e[0], e[1]), t.width < 0 && (t.width = 0), t.height < 0 && (t.height = 0), t[o(336)]();
    let l = t.getWorldTransform(), c = this._anchorToLocalPoint(t, r);
    c = l.point(c);
    let d = a.x - c.x, h = a.y - c.y;
    t.translateWith(d, h), this.nodeResizeBox.updateSize();
  }
  [D(344)]() {
  }
  pointeroutHandler(t) {
  }
  pointerdownHandler(t) {
    t[D(354)]();
  }
  [D(355)](t) {
    t.preventDefault();
  }
}
const de = G;
function G(n, t) {
  const e = jt();
  return (G = function(s, i) {
    return e[s -= 392];
  })(n, t);
}
(function() {
  const n = G, t = jt();
  for (; ; )
    try {
      if (parseInt(n(393)) / 1 * (-parseInt(n(400)) / 2) + parseInt(n(398)) / 3 * (-parseInt(n(394)) / 4) + -parseInt(n(402)) / 5 * (-parseInt(n(411)) / 6) + -parseInt(n(404)) / 7 * (-parseInt(n(405)) / 8) + parseInt(n(401)) / 9 + -parseInt(n(423)) / 10 + -parseInt(n(406)) / 11 * (-parseInt(n(395)) / 12) === 569415)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class De extends wt {
  constructor(t, e) {
    const s = G;
    super(), this[s(396)] = t[s(396)], this.stage = this[s(396)][s(414)], this.selectedGroup = this.stage.selectedGroup, this[s(418)](I.nodeRotatePoint.style), this[s(399)](I[s(410)].width, I.nodeRotatePoint.height), this[s(415)] = e;
  }
  getRotationWithMouse(t, e) {
    const s = G;
    let i = e.inputSystem, o = { x: 0, y: 0 }, r = t[s(421)].getConnectionAnchor(t.originPosition);
    r != null && (o = Lt.calcPointByAnchor(t, r));
    let a = t.getWorldTransform().point(o);
    return Math[s(412)](i.yInWorld - a.y, i[s(419)] - a.x);
  }
  pointermoveHandler() {
    const t = G;
    this[t(414)].setCursor(w[t(407)]);
  }
  pointerdownHandler(t) {
    const e = G;
    t.preventDefault();
    let s = this.stage;
    if (this.selectedGroup.getTopObjects().length == 0)
      throw new Error("selectedGroup.length is 0!");
    let i = s.inputSystem.target;
    this[e(392)] = i[e(413)], this[e(397)] = this[e(403)](i, s);
  }
  pointerupHandler(t) {
    const e = G;
    this.stage[e(409)](w.auto), t.event.preventDefault();
  }
  [de(422)](t) {
    const e = de;
    t.event.preventDefault();
    let s = this.parent, i = s.editor, o = i[e(414)], r = o[e(408)][e(416)], a = this.getRotationWithMouse(r, o) - this.mouseInitAngle;
    if (r[e(420)](this.elementInitAngle + a), s.updateSize(), a != 0 && i[e(417)]("rotate")) {
      let l = new M("rotate", { target: r, details: { dAngle: a } });
      i.dispatchEvent(l);
    }
  }
}
function jt() {
  const n = ["editor", "mouseInitAngle", "615voHeAt", "resize", "10NBOqmW", "6652305ArapLC", "240Qhxfma", "getRotationWithMouse", "140OSfzcH", "137696LRgpdT", "1304479GDWHqg", "move", "inputSystem", "setCursor", "nodeRotatePoint", "66828rQLfcQ", "atan2", "rotation", "stage", "name", "target", "hasListener", "setStyles", "xInWorld", "rotate", "_shape", "dragHandler", "6046530aRvSCC", "elementInitAngle", "197123aSuGqc", "14884VXSvCL", "132ggGoDE"];
  return (jt = function() {
    return n;
  })();
}
function ve(n, t) {
  const e = zt();
  return (ve = function(s, i) {
    return e[s -= 182];
  })(n, t);
}
(function() {
  const n = ve, t = zt();
  for (; ; )
    try {
      if (-parseInt(n(182)) / 1 + parseInt(n(189)) / 2 * (-parseInt(n(187)) / 3) + parseInt(n(185)) / 4 + -parseInt(n(191)) / 5 * (-parseInt(n(186)) / 6) + -parseInt(n(188)) / 7 + -parseInt(n(190)) / 8 + -parseInt(n(183)) / 9 * (-parseInt(n(184)) / 10) === 248241)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const ft = { LinkCtrlBox: 10002, NodeCtrlBox: 10001, IntersectPoint: 10003, EditorNewLink: 3 };
function zt() {
  const n = ["185343mnZiJN", "989842GvBjfz", "16fUYFjb", "3746512XZmouU", "87110UmRPYq", "177386dINmyH", "666CEZymb", "158520yTDwiN", "1147436EiBJGg", "24ROXMpF"];
  return (zt = function() {
    return n;
  })();
}
const R = yt;
function yt(n, t) {
  const e = _t();
  return (yt = function(s, i) {
    return e[s -= 222];
  })(n, t);
}
function _t() {
  const n = ["beginArrow", "3919059CjqCQD", "254964zNRGtf", "645475lhpEgP", "updateSize", "updateMatrix", "723040TRgIXD", "initCtrlPoints", "attachTo", "2648632oyLxoc", "setStyles", "clearTarget", "112eyVAgv", "_anchorToLocalPoint", "rotateLink", "994196JGnqUY", "rotate", "8cUFTKD", "parent", "pointerEnabled", "582966gtziWL", "length"];
  return (_t = function() {
    return n;
  })();
}
(function() {
  const n = yt, t = _t();
  for (; ; )
    try {
      if (parseInt(n(232)) / 1 + parseInt(n(241)) / 2 + parseInt(n(224)) / 3 + -parseInt(n(235)) / 4 + -parseInt(n(229)) / 5 + -parseInt(n(228)) / 6 * (parseInt(n(238)) / 7) + parseInt(n(243)) / 8 * (parseInt(n(227)) / 9) === 378754)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class je extends k {
  constructor(t, e = 0, s = 0, i = 1, o = 1) {
    super(null, e, s, i, o), this.resizePoints = [], this.zIndex = ft.NodeCtrlBox, this.editor = t, this.pointerEnabled = !1, this.hide(), this.initCtrlPoints();
  }
  [R(233)]() {
    const t = R;
    let e = this, s = new De(this, t(242));
    this.addChild(s), this.rotateNode = s;
    let i = new x();
    i[t(236)](I.nodeRotatePoint.rotateLineStyle), i[t(223)] = !1, this[t(240)] = i, this.addChild(i), this.rotateLink = i, ["lt", "lb", "rt", "rb"].forEach((o) => {
      let r = new Be(this, o);
      e.resizePoints.push(r);
    }), this.addChildren(this.resizePoints);
  }
  _anchorToLocalPoint(t, e) {
    return t._positionToLocalPoint(e);
  }
  [R(234)](t) {
    const e = R;
    if (t != null) {
      if (!function(s) {
        const i = yt;
        let o = s[i(222)];
        return o instanceof x && (o[i(226)] === s || o.endArrow === s);
      }(t)) {
        if (!this.editor.isEditable(t))
          throw new Error("attach not Node or not editable");
        this.currNode = t, this[e(230)](), this.show();
      }
    } else
      this[e(237)]();
  }
  [R(230)]() {
    const t = R;
    let e = this.currNode;
    if (e == null || e.isSelected == 0 || e.parent == null)
      return this.currNode = null, void this.hide();
    let s = this.editor.stage.camera, i = this.currNode;
    i[t(231)]();
    let o = s.getObjectScreenTransform(i);
    {
      let r = this[t(239)](i, b.ct), a = o.point(r);
      r.y -= I.nodeRotatePoint.rotateLineLength, r = o.point(r), this.rotateLink.setBegin(a), this.rotateLink.setEnd(r), this.rotateNode.translate(r.x, r.y);
    }
    for (let r = 0; r < this.resizePoints[t(225)]; r++) {
      let a = this.resizePoints[r], l = this._anchorToLocalPoint(i, a.name);
      l = o.point(l), a.translate(l.x, l.y);
    }
  }
  update() {
    const t = R;
    super.update(), this.visible && this.currNode != null && this[t(230)]();
  }
  clearTarget() {
    this.currNode = null, this.hide();
  }
  pointeroutStageHandler() {
  }
  pointerenterStageHandler() {
  }
}
const X = st;
function st(n, t) {
  const e = Ot();
  return (st = function(s, i) {
    return e[s -= 225];
  })(n, t);
}
function Ot() {
  const n = ["style", "LinkEnd", "LinkBegin", "begin", "unActive", "size", "149156IIGBns", "1038545RTNBbk", "linkCtrlPoint", "connectBox", "editor", "parent", "active", "findConnectableEndpoint", "isActive", "host", "4388368LjRQQo", "activeStyle", "anchor", "ADJUST", "dragHandler", "5606442kluhTE", "setCursor", "1989330xZXFGC", "updateMatrix", "6UGwlTM", "update", "setBegin", "usage", "533253zLxeNE", "equals", "inputSystem", "isConnectPoint", "2296036bmOPwe", "15yMNzNw", "pointermoveHandler", "xInWorld", "canConnectAnchorProxy", "name"];
  return (Ot = function() {
    return n;
  })();
}
(function() {
  const n = st, t = Ot();
  for (; ; )
    try {
      if (parseInt(n(252)) / 1 + parseInt(n(229)) / 2 * (-parseInt(n(257)) / 3) + parseInt(n(256)) / 4 + parseInt(n(230)) / 5 * (-parseInt(n(248)) / 6) + -parseInt(n(246)) / 7 + -parseInt(n(239)) / 8 + parseInt(n(244)) / 9 === 316865)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class ze extends wt {
  constructor(t, e) {
    const s = st;
    super(), this[s(255)] = !0, this.isActive = !1, this[s(241)] = e, this.linkCtrlBox = t, this.setRadius(I[s(231)][s(228)]), this[s(233)] = this.linkCtrlBox.editor, this.setStyles(I.linkCtrlPoint[s(262)]);
  }
  active() {
    const t = st;
    this.setStyles(I.linkCtrlPoint[t(240)]), this.isActive = !0;
  }
  [X(227)]() {
    this.setStyles(I.linkCtrlPoint.unactiveStyle), this.isActive = !1;
  }
  pointermoveHandler(t) {
    const e = X;
    this.editor[e(232)].hide();
    let s = this.parent.attachedLink, i = this.editor.stage, o = s.parent.worldToLocalXY(i.inputSystem[e(259)], i.inputSystem.yInWorld);
    this[e(241)][e(258)](s, i, o);
  }
  pointerdownHandler(t) {
    const e = X;
    this[e(233)].stage[e(245)](w.auto), this[e(260)] = null;
  }
  [X(243)](t) {
    const e = X;
    let s = this[e(234)], i = s.parent.stage;
    const o = this.editor;
    let r = s.attachedLink;
    o[e(232)].hide();
    const a = this[e(261)], l = this[e(241)];
    t.isDragStart && l[e(251)] & et[e(242)] && this[e(235)]();
    let c = r.parent.worldToLocalXY(i.inputSystem.xInWorld, i[e(254)].yInWorld);
    if (a == A[e(225)] || a == A[e(263)])
      return l[e(258)](r, i, c), void (this.canConnectAnchorProxy = o.connectBox[e(236)]([r]));
    l.pointermoveHandler(r, i, c), s[e(249)]();
  }
  pointerupHandler(t) {
    const e = X;
    this.editor.stage.setCursor(w.auto), t.event.preventDefault();
    let s = this.parent.attachedLink, i = this.anchor.name;
    if (this[e(260)] != null && !this.canConnectAnchorProxy[e(253)](s[e(226)]) && !this[e(260)].equals(s.end)) {
      let o = this.canConnectAnchorProxy, r = o[e(238)];
      if (r.isLink) {
        let a = r;
        a.end.host !== s && a[e(226)].host !== s && (i == A[e(225)] ? s.setBegin(o) : i == A.LinkEnd && s.setEnd(o), s._upgradeParent(), s[e(247)]());
      } else
        i == A[e(225)] ? s[e(250)](o) : i == A.LinkEnd && s.setEnd(o), s._upgradeParent(), s.updateMatrix();
    }
    this[e(237)] && this.unActive(), this.canConnectAnchorProxy = null;
  }
}
const K = W;
function Nt() {
  const n = ["filter", "917814qGZMqW", "anchor", "1142520LfYneJ", "center", "4053690uEjpjp", "update", "QuadBezierLinkCtrlPoint", "714327zEQHFS", "attachTo", "ctrlLinkStyle", "189692UVDqLv", "values", "hide", "228671ceeNaN", "join", "isConnectPoint", "pointeroutStageHandler", "2Jirzhh", "_createCtrlLink", "clearTarget", "15sCHUgI", "BezierLinkCtrlPoint1", "9JVeFVj", "linkCtrlPoint", "get", "anchorNameStr", "parent", "attachedLink", "ctrlLine", "setStyles", "clear", "zIndex", "1315769XIcJJJ", "CONNECT_EDIT", "LinkBegin", "pointXY", "ctrlPointMap"];
  return (Nt = function() {
    return n;
  })();
}
function W(n, t) {
  const e = Nt();
  return (W = function(s, i) {
    return e[s -= 200];
  })(n, t);
}
(function() {
  const n = W, t = Nt();
  for (; ; )
    try {
      if (parseInt(n(215)) / 1 + parseInt(n(219)) / 2 * (-parseInt(n(209)) / 3) + -parseInt(n(212)) / 4 * (parseInt(n(222)) / 5) + -parseInt(n(202)) / 6 + parseInt(n(234)) / 7 + -parseInt(n(204)) / 8 + -parseInt(n(224)) / 9 * (-parseInt(n(206)) / 10) === 145845)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class _e extends k {
  constructor(t) {
    const e = W;
    super(), this[e(200)] = /* @__PURE__ */ new Map(), this[e(233)] = ft.LinkCtrlBox, this.editor = t, this.init();
  }
  attachTo(t) {
    this.createCtrlPoints(t), this.updateCtrlPoints(), this.show();
  }
  createCtrlPoint(t) {
    let e = new ze(this, t);
    return e.name = t.name, this.addChild(e), e;
  }
  updateSize() {
    const t = W, e = this.editor.stage.inputSystem.target;
    this[t(229)] && this.attachedLink[t(228)] != null ? this.attachedLink.parent == null || e == null || this.attachedLink != e ? (this.attachedLink = null, this.hide()) : this[t(210)](this.attachedLink) : this.hide();
  }
  createCtrlPoints(t) {
    const e = W;
    this.removeAllChildren(), this[e(200)].clear(), this.attachedLink = t;
    let s = Array.from(t.getShape().getAnchors().values())[e(201)]((o) => o.usage & et.ADJUST), i = s.map((o) => o.name);
    this[e(227)] = i[e(216)](",");
    for (let o = 0; o < s.length; o++) {
      let r = s[o], a = r.name, l = this.createCtrlPoint(r);
      this.ctrlPointMap.set(a, l);
    }
    for (let o of this.ctrlPointMap[e(213)]()) {
      let r = o[e(203)], a = r.name;
      if (r.usage != (et[e(235)] | et.ADJUST) && (o[e(231)](I.linkCtrlPoint.adjustStyle), o[e(217)] = !1), a == A[e(208)]) {
        let l = this.ctrlPointMap.get(A[e(236)]), c = this[e(220)](o.getAnchor(b[e(205)]), l.getAnchor(b[e(205)]));
        o.ctrlLine = c;
      } else if (a == A[e(223)]) {
        let l = this.ctrlPointMap[e(226)](A.LinkBegin), c = this[e(220)](o.getAnchor(b.center), l.getAnchor(b.center));
        o.ctrlLine = c;
      } else if (a == A.BezierLinkCtrlPoint2) {
        let l = this[e(200)].get(A.LinkEnd), c = this._createCtrlLink(o.getAnchor(b.center), l.getAnchor(b.center));
        o[e(230)] = c;
      }
    }
  }
  _createCtrlLink(t, e) {
    const s = W;
    let i = new x(null, t, e);
    return i.setStyles(I[s(225)][s(211)]), this.addChild(i), i.pointerEnabled = !1, i;
  }
  updateCtrlPoints() {
    const t = W, e = this.attachedLink;
    let s = this.editor.stage.camera.getObjectScreenTransform(e);
    for (let i of this[t(200)].values()) {
      let o = i.anchor, r = Lt.calcPointByAnchor(e, o), a = s[t(237)](r.x, r.y);
      i.translate(a.x, a.y);
    }
  }
  [K(207)]() {
    super[K(207)](), this.visible && this.attachedLink != null && this.updateCtrlPoints();
  }
  [K(221)]() {
    const t = K;
    this[t(200)].clear(), this.removeAllChildren(), this[t(214)]();
  }
  init() {
    const t = K;
    this[t(200)][t(232)](), this.hide();
  }
  [K(218)]() {
  }
  pointerenterStageHandler() {
  }
}
function Gt(n, t) {
  const e = Wt();
  return (Gt = function(s, i) {
    return e[s -= 160];
  })(n, t);
}
const E = Gt;
(function() {
  const n = Gt, t = Wt();
  for (; ; )
    try {
      if (-parseInt(n(175)) / 1 * (parseInt(n(174)) / 2) + parseInt(n(164)) / 3 + parseInt(n(195)) / 4 + parseInt(n(188)) / 5 + parseInt(n(163)) / 6 * (-parseInt(n(172)) / 7) + -parseInt(n(184)) / 8 + parseInt(n(183)) / 9 === 909997)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
var pe, Oe = Object.defineProperty, Ne = Object[E(173)];
function Wt() {
  const n = ["unActiveStyle", "name", "distance", "getShape", "connectBox", "active", "size", "equals", "43638HKJdNP", "2012613vuknkn", "update", "link", "length", "preventDefault", "recordEnd", "end", "editor", "707utoEIB", "getOwnPropertyDescriptor", "2wgTxHy", "549867pBETZQ", "record", "pointerenterHandler", "pointerupHandler", "connectPoint", "anchorProxy", "lineDrawn", "target", "12507372SepNhk", "5825968MKwaxa", "show", "inputSystem", "activeStyle", "904410HZPgke", "isActive", "drawStartInfo", "setEnd", "prototype", "auto", "intersect", "2724888rJBSHV", "removeFromParent"];
  return (Wt = function() {
    return n;
  })();
}
class ht extends k {
  constructor(t, e = 0, s = 0, i = 1, o = 1, r) {
    const a = E;
    super(null, e, s, i, o), this.isActive = !1, this.isIntersectPoint = !1, this.connectBox = t, this[a(171)] = t[a(171)], this.stage = this.editor.stage, this.resize(I.connectPoint.size, I.connectPoint[a(161)]), this.setStyles(I[a(179)].style), this.unactive(), this.anchor = r;
  }
  setIntersect(t) {
    this[E(194)] = t;
  }
  [E(177)]() {
    this[E(160)]();
  }
  pointeroutHandler() {
    this.stage.setCursor(w.auto), this.unactive();
  }
  pointermoveHandler() {
  }
  pointerdownHandler() {
    const t = E;
    event[t(168)](), this.editor.stage.setCursor(w[t(193)]), this.link = null;
  }
  dragHandler(t) {
    const e = E;
    if (t.buttons == 2)
      return;
    const s = this.editor, i = s.stage;
    this.connectBox.activedPoint && this.connectBox.activedPoint.unactive();
    const o = this.connectBox[e(182)];
    if (t.isDragStart) {
      let r;
      if (this.isIntersectPoint) {
        let a = this[e(201)].intersect;
        r = o.getSegmentAnchor(a.t, a.segIndex);
      } else
        r = o.getAnchor(this[e(198)]);
      this[e(190)] = { x: t.x, y: t.y, beginAnchorProxy: r, timeStamp: Date.now() };
    } else {
      if (this.drawStartInfo != null) {
        let r = nt[e(199)](this.drawStartInfo.x, this.drawStartInfo.y, t.x, t.y);
        if (Date.now() - this.drawStartInfo.timeStamp > I[e(179)].drawStartDelay && r > I.connectPoint.drawStartMinDistance) {
          this.editor[e(176)]("绘制新线");
          let a = { x: i.inputSystem.xInWorld, y: i.inputSystem.yInWorld };
          const l = s.instanceManager[e(181)](o, a, this.drawStartInfo.beginAnchorProxy);
          this[e(166)] = l;
          let c = l.parent.worldToLocalXY(i.inputSystem.xInWorld, i.inputSystem.yInWorld);
          l[e(191)](c), this.drawStartInfo = null;
        }
      }
      if (this.link != null && this.link[e(170)] != null) {
        let r = this.link.parent.worldToLocalXY(i.inputSystem.xInWorld, i[e(186)].yInWorld);
        this.link.setEnd(r), this.anchorProxy = this[e(201)].findConnectableEndpoint([this.link, this.link[e(170)].host]);
      }
    }
  }
  [E(178)](t) {
    const e = E;
    this[e(185)](), this.editor[e(165)](), this[e(171)].stage.setCursor(w.auto), this.link != null && (this.anchorProxy && (this[e(180)][e(162)](this[e(166)].begin) ? this.link[e(196)]() : (this.link.setEnd(this.anchorProxy), this.link._upgradeParent(), this[e(171)].instanceManager.lineDrawingFinished(this[e(166)]))), this.editor[e(169)]("绘制新线")), this.link = null;
  }
  active() {
    const t = E;
    this[t(189)] = !0, this.setStyles(I.connectPoint[t(187)]), this.scale(1.2, 1.2);
  }
  unactive() {
    const t = E;
    this.isActive = !1, this.setStyles(I.connectPoint[t(197)]), this.scale(1, 1);
  }
}
((n, t, e, s) => {
  const i = E;
  for (var o, r = s > 1 ? void 0 : s ? Ne(t, e) : t, a = n[i(167)] - 1; a >= 0; a--)
    (o = n[a]) && (r = (s ? o(t, e, r) : o(r)) || r);
  s && r && Oe(t, e, r);
})([(pe = Ct[E(200)]("Ellipse"), (n, t) => {
  n[t] = pe;
})], ht[E(192)], "_shape", 2);
const ue = It;
function It(n, t) {
  const e = Ft();
  return (It = function(s, i) {
    return e[s -= 122];
  })(n, t);
}
function Ft() {
  const n = ["1568260dsryup", "12dWljud", "569442HNUfZq", "length", "isAlignable", "2771692fnyvFG", "selectedGroup", "3593765EEEMaG", "isKeydown", "beginArrow", "parent", "3mavMZF", "6804304ESxtFe", "726196eRdUeE", "label", "21698802hlFNpU"];
  return (Ft = function() {
    return n;
  })();
}
(function() {
  const n = It, t = Ft();
  for (; ; )
    try {
      if (-parseInt(n(130)) / 1 * (parseInt(n(132)) / 2) + -parseInt(n(137)) / 3 + parseInt(n(135)) / 4 + -parseInt(n(126)) / 5 + parseInt(n(136)) / 6 * (parseInt(n(124)) / 7) + -parseInt(n(131)) / 8 + parseInt(n(134)) / 9 === 746556)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class J {
  static isUpdateMatrixed(t) {
    return t._obb != null && t._obb.points != null;
  }
  static connectable(t, e, s) {
    return J.isUpdateMatrixed(t) && s.indexOf(t) == -1 && e.isConnectable(t);
  }
  static aliagnAble(t, e) {
    const s = It;
    return (i) => i.isNode && i !== e && i !== i.parent[s(128)] && i !== i[s(129)].endArrow && i !== i.parent[s(133)];
  }
  static [ue(123)](t) {
    const e = ue;
    return !(t.keyboard[e(127)](ut.DisableNodeAlign) || t.stage[e(125)].objects[e(122)] > 1);
  }
}
const S = tt;
function tt(n, t) {
  const e = Rt();
  return (tt = function(s, i) {
    return e[s -= 271];
  })(n, t);
}
(function() {
  const n = tt, t = Rt();
  for (; ; )
    try {
      if (-parseInt(n(285)) / 1 + parseInt(n(282)) / 2 + parseInt(n(319)) / 3 * (parseInt(n(295)) / 4) + parseInt(n(314)) / 5 * (-parseInt(n(312)) / 6) + -parseInt(n(297)) / 7 * (-parseInt(n(318)) / 8) + parseInt(n(320)) / 9 * (-parseInt(n(276)) / 10) + parseInt(n(315)) / 11 * (-parseInt(n(304)) / 12) === 294234)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ge extends k {
  constructor(t, e = 0, s = 0, i = 1, o = 1) {
    const r = tt;
    super(null, e, s, i, o), this.editor = t;
    let a = new Le("intersectPoint", 0, -1);
    this.ctrlIntersectPoint = this.createAnchorPoint("intersectPoint", a), this.ctrlIntersectPoint[r(288)] = !0, this.ctrlIntersectPoint.hide();
  }
  setTarget(t) {
    const e = tt;
    if (this.editor.isConnectable(t)) {
      if (this.target !== t) {
        if (this.target = t, t != null && (t instanceof k || t instanceof x)) {
          this.removeAllChildren(), this.addChild(this[e(287)]);
          let s = ge(t);
          for (let i of s)
            this.createAnchorPoint(i.name, i);
        }
        this[e(278)]();
      }
      this.children.forEach((s) => s.unactive()), this[e(287)].hide(), this.show();
    }
  }
  adjustConnectNodes() {
    const t = tt;
    if (this.target == null || this.target.parent == null)
      return void this.clearTarget();
    const e = this[t(289)];
    let s = this.editor.stage[t(279)].getObjectScreenTransform(e);
    const i = this.children;
    for (let o = 0; o < i[t(272)]; o++) {
      const r = i[o];
      if (!r.isIntersectPoint) {
        if (r.name != null) {
          let a = r.anchor, l = Lt[t(271)](e, a), c = s.point(l);
          r.translate(c.x, c.y);
        }
      }
    }
  }
  [S(296)](t, e) {
    const s = S;
    if (e == null)
      throw new Error(s(291));
    this[s(301)](t), this[s(307)](e), this.show();
  }
  clearActived() {
    const t = S;
    this.activedPoint && this.activedPoint[t(277)](), this[t(287)][t(283)]();
  }
  [S(307)](t) {
    const e = S;
    this.activedPoint && this.activedPoint[e(277)]();
    let s = this.children.filter((i) => i.name == t)[0];
    this[e(274)] = s, s[e(275)](), this[e(287)].hide();
  }
  showIntersectAnchor(t) {
    const e = S;
    if (this.intersect = t, t == null)
      return void this.ctrlIntersectPoint.hide();
    let s = t.t, i = t.segIndex;
    const o = this[e(289)];
    let r = o.getLocalPoint(s, i), a = this.editor.stage.camera[e(310)](o).point(r);
    this.ctrlIntersectPoint[e(306)](a.x, a.y), this.ctrlIntersectPoint.setStyles(I.connectPoint[e(293)]), this.ctrlIntersectPoint.show();
  }
  [S(298)](t, e) {
    const s = new ht(this, 0, 0, 1, 1, e);
    return s.name = t, s.connectBox = this, this.addChild(s), s;
  }
  getObjectsIntersect(t) {
    const e = S;
    let s = this[e(313)].stage, i = { x: s.inputSystem.xInWorld, y: s[e(273)][e(281)] };
    const o = I.connectBox.nodeDist;
    let r = Number.MAX_SAFE_INTEGER, a = null;
    for (let l = 0; l < t.length; l++) {
      const c = t[l];
      let d = F.getNearestPoint(c, i);
      d.dist < o && d.dist < r && (r = d[e(299)], d.object = c, a = d);
    }
    return a;
  }
  getConnectableEndpointFromObjects(t) {
    const e = S, s = this[e(313)], i = this, o = s.stage, r = o[e(273)], a = { x: r.x, y: r.y }, l = this[e(316)](o.camera, a, t, I[e(302)][e(286)] / 2), c = s.keyboard[e(305)]();
    if (l.length == 0 && !c) {
      let h = function(p, u) {
        const g = S, m = p.getCurrentLayer(), f = { x: p[g(273)].xInWorld, y: p.inputSystem.yInWorld };
        let v = m.displayList.filter((T) => T.isNode), L = v.map((T, B) => {
          let _ = T._obb.aabb.getCenter();
          return { index: B, dist: nt.distance(f.x, f.y, _.x, _.y) };
        });
        if (L = L[g(294)]((T) => T.dist <= u), L.length == 0)
          return null;
        L[g(311)]((T, B) => T.dist - B.dist);
        let z = L[0].index;
        return v[z];
      }(o, 100);
      return this.editor.isConnectable(h) && i.setTarget(h), null;
    }
    if (l.length > 0) {
      l[e(311)]((m, f) => {
        let v = m.object, L = f.object;
        return c ? (v instanceof x ? 0 : 1) - (L instanceof x ? 0 : 1) : (v instanceof k ? 0 : 1) - (L instanceof k ? 0 : 1);
      });
      const h = l[0], p = h[e(300)];
      let u = h.anchorName;
      const g = p.getAnchor(u);
      return i[e(296)](p, u), g;
    }
    const d = this.getObjectsIntersect(t);
    if (d != null) {
      const h = d[e(300)];
      if (h instanceof k || h instanceof x) {
        i.setTarget(h);
        const p = h.getSegmentAnchor(d.t, d.segIndex);
        return this.showIntersectAnchor(d), p;
      }
      throw new Error("unknow intersect object:" + h);
    }
    return i[e(284)](), null;
  }
  [S(292)](t) {
    const e = S, s = this[e(313)], i = s.stage[e(279)][e(303)][e(309)]()._findChildren(function(o) {
      return J.connectable(o, s, t);
    }, !0);
    return this.getConnectableEndpointFromObjects(i);
  }
  [S(316)](t, e, s, i) {
    const o = S;
    let r = [];
    for (let a = 0; a < s.length; a++) {
      const l = s[a], c = t.getObjectScreenTransform(l);
      let d = ge(l);
      for (let h of d) {
        let p = F.anchorToLocalPoint(l, h.name), u = c.point(p), g = nt.distance(u.x, u.y, e.x, e.y);
        if (g < i) {
          const m = { distance: g, object: l, anchorName: h.name };
          r.push(m);
        }
      }
    }
    return r[o(311)]((a, l) => a.distance - l.distance), r;
  }
  update() {
    super[S(308)](), this.adjustConnectNodes();
  }
  [S(284)]() {
    const t = S;
    this.target = null, this[t(283)]();
  }
  cancel() {
  }
  pointeroutStageHandler() {
  }
  pointerenterStageHandler() {
  }
}
function ge(n) {
  const t = S;
  let e = n._shape[t(280)](), s = [];
  for (let i of e)
    i[t(290)] & et.CONNECT_EDIT && s[t(317)](i);
  return s;
}
function Rt() {
  const n = ["adjustConnectNodes", "camera", "getConnectionAnchors", "yInWorld", "459930XdiNSj", "hide", "clearTarget", "176373OfBHpi", "size", "ctrlIntersectPoint", "isIntersectPoint", "target", "usage", "activeNameOrPoint is null", "findConnectableEndpoint", "activeStyle", "filter", "49052HnTrrh", "setTargetWithName", "71918JifPFn", "createAnchorPoint", "dist", "object", "setTarget", "connectPoint", "localView", "181236ZkqOYA", "isControlDown", "translate", "activePointByName", "update", "getObject", "getObjectScreenTransform", "sort", "122226WAvDTG", "editor", "85dDMuaS", "198MLSmKW", "getNearestAnchorOnObjects", "push", "416BzGVVe", "84mDoaXd", "24183ZPJwxC", "calcPointByAnchor", "length", "inputSystem", "activedPoint", "active", "70zKtuuo", "unactive"];
  return (Rt = function() {
    return n;
  })();
}
const j = Vt;
function Vt(n, t) {
  const e = Ut();
  return (Vt = function(s, i) {
    return e[s -= 444];
  })(n, t);
}
function Ut() {
  const n = ["3173710kalJQv", "18LuHtZd", "3251088IWLFwg", "shift", "1629111mQIzSa", "push", "checkHistoryLength", "位置改变", "clear", "editor", "835JjWcKi", "21EfhXDe", "undoHistory", "9868ybrqis", "undoFn", "622011OFjFLv", "pop", "redoHistory", "undo", "5697274yyzMdF", "1257688KenQHn", "length", "redo", "2vfLstE"];
  return (Ut = function() {
    return n;
  })();
}
(function() {
  const n = Vt, t = Ut();
  for (; ; )
    try {
      if (-parseInt(n(458)) / 1 + parseInt(n(466)) / 2 * (-parseInt(n(447)) / 3) + -parseInt(n(456)) / 4 * (parseInt(n(453)) / 5) + parseInt(n(445)) / 6 + -parseInt(n(454)) / 7 * (-parseInt(n(463)) / 8) + parseInt(n(444)) / 9 * (parseInt(n(467)) / 10) + parseInt(n(462)) / 11 === 589120)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})(), j(450);
class We {
  constructor(t, e, s) {
    this.type = t, this.undoFn = s, this.redoFn = e;
  }
  [j(465)]() {
    this.redoFn();
  }
  undo() {
    this[j(457)]();
  }
}
class Fe extends EventTarget {
  constructor(t) {
    super(), this.historyMaxLength = 10, this.editor = t, this.undoHistory = [], this.redoHistory = [];
  }
  [j(451)]() {
    this.undoHistory = [], this.redoHistory = [];
  }
  push(t, e, s) {
    const i = j;
    let o = new We(t, e, s);
    return o[i(452)] = this.editor, this[i(460)].length = 0, this.undoHistory.push(o), this.checkHistoryLength(), o;
  }
  undo() {
    const t = j;
    if (this[t(455)][t(464)] == 0)
      return null;
    let e = this.undoHistory.pop();
    return e[t(461)](), this[t(460)].push(e), this[t(449)](), e;
  }
  redo() {
    const t = j;
    if (this.redoHistory.length == 0)
      return null;
    let e = this.redoHistory[t(459)]();
    return e[t(465)](), this[t(455)][t(448)](e), this.checkHistoryLength(), e;
  }
  [j(449)]() {
    const t = j;
    this.undoHistory.length > this.historyMaxLength && this.undoHistory[t(446)](), this.redoHistory.length > this.historyMaxLength && this[t(460)].shift();
  }
}
function Z(n, t) {
  const e = Jt();
  return (Z = function(s, i) {
    return e[s -= 350];
  })(n, t);
}
(function() {
  const n = Z, t = Jt();
  for (; ; )
    try {
      if (parseInt(n(364)) / 1 + -parseInt(n(355)) / 2 + -parseInt(n(362)) / 3 * (-parseInt(n(363)) / 4) + -parseInt(n(350)) / 5 + -parseInt(n(361)) / 6 * (-parseInt(n(357)) / 7) + parseInt(n(352)) / 8 + -parseInt(n(356)) / 9 * (parseInt(n(353)) / 10) === 483237)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Re = { getItem: function(n) {
  return localStorage.getItem(n);
}, setItem: function(n, t) {
  localStorage[Z(351)](n, t);
}, saveWithVersion(n, t) {
  n += Date[Z(354)](), this.setItem(n, t);
}, getAllVersions(n) {
  const t = Z;
  return Object[t(360)](localStorage)[t(365)]((e) => e[t(359)](n)).sort();
}, getLastVersion(n, t) {
  const e = Z;
  let s = this.getAllVersions(n).reverse();
  if (s.length == 0)
    return;
  t == null && (t = 0), t + 1 >= s.length && (t = s.length - 1);
  let i = s[t];
  return this[e(358)](i);
} };
function Jt() {
  const n = ["18wGVBSz", "51XvYNyo", "190956GjNLka", "78149HiMYsG", "filter", "52920eKhgOa", "setItem", "2363808AjviGY", "10FoybMT", "now", "1702212AsPopZ", "5255892NxVVSc", "1735363hgecVt", "getItem", "startsWith", "keys"];
  return (Jt = function() {
    return n;
  })();
}
function dt(n, t) {
  const e = Yt();
  return (dt = function(s, i) {
    return e[s -= 462];
  })(n, t);
}
function Yt() {
  const n = ["keyup", "camera", "stylePasteHandler", "63HlVBxS", "19666310nyNewU", "36376BTWgat", "deleteHandler", "init", "bindKey", "Move_right", "6458432fkAvEV", "LocalView", "Copy", "4154499lNaKFQ", "Layout_grid", "showOpTooltip", "redo", "6594120RXDLFw", "stage", "editor", "isNode", "10LEKYgF", "4893iaJaoZ", "4602CPqIlW", "filter", "getCurrentLayer", "isArray", "addEventListener", "styleCopyHandler", "redoUndoSys", "clearCtrlBoxs", "333728UiPYeC", "粘贴样式", "getTopObjects", "forEach"];
  return (Yt = function() {
    return n;
  })();
}
(function() {
  const n = dt, t = Yt();
  for (; ; )
    try {
      if (-parseInt(n(493)) / 1 * (-parseInt(n(468)) / 2) + parseInt(n(485)) / 3 + parseInt(n(482)) / 4 + -parseInt(n(489)) / 5 + parseInt(n(495)) / 6 * (-parseInt(n(494)) / 7) + parseInt(n(477)) / 8 * (parseInt(n(475)) / 9) + -parseInt(n(476)) / 10 === 878322)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ve {
  constructor(t) {
    const e = dt;
    this.editor = t, this[e(479)]();
  }
  init() {
    const t = dt, e = this[t(491)], s = e[t(490)], i = e[t(462)]();
    let o = e.stage.keyboard;
    const r = e.keyConfig;
    function a(l, c, d) {
      const h = t;
      !Array[h(463)](l) && (l = [l]), l.forEach((p) => {
        o[h(480)](p, function(u) {
          c(u);
        }, d);
      });
    }
    o[t(464)](t(472), function(l) {
      e.update();
    }), a(r.Delete, (l) => e.editorEventManager[t(478)](l)), a(r.Cut, (l) => e.clipboardManager.cutHandler(l)), a(r[t(484)], (l) => {
      e.showOpTooltip("复制"), e.clipboardManager.copyHandler(l);
    }), a(r.Paste, (l) => e.clipboardManager.pasteHandler(l)), a(r.Undo, (l) => {
      e.showOpTooltip("撤销"), e.redoUndoSys.undo(), e.clearCtrlBoxs();
    }), a(r.Redo, (l) => {
      const c = t;
      e.showOpTooltip("重做"), e[c(466)][c(488)](l), e[c(467)]();
    }), a(r.Select_all, (l) => {
      const c = t;
      e.showOpTooltip("全选");
      let d = s[c(473)].localView.getObject(), h = ke.flatten(d.children, (p) => p.visible == 1);
      s.select(h);
    }), a(r.Select_invert, (l) => {
      const c = t;
      e[c(487)]("反选");
      let d = s.selectedGroup[c(470)]();
      s.select(i.displayList.filter((h) => !d.includes(h)));
    }), a(r.Save, (l) => {
      e[t(487)]("保存"), e.saveHandler(l, e.imageToBase64);
    }, !1), a(r.Open, (l) => {
      e.showOpTooltip("打开"), e.openLasted(l);
    }, !1), a(r[t(483)], (l) => {
      e.toogleLocalView();
    }), a(r.Copy_style, (l) => {
      const c = t;
      e.showOpTooltip("复制样式"), e.clipboardManager[c(465)](l);
    }, !1), a(r.paste_Style, (l) => {
      const c = t;
      e.showOpTooltip(c(469)), e.clipboardManager[c(474)](l);
    }, !1), a(r.Move_left, (l) => {
      const c = t;
      s.selectedGroup.getTopObjects()[c(496)]((d) => d[c(492)]).forEach((d) => {
        d.x -= 1;
      });
    }), a(r[t(481)], (l) => {
      const c = t;
      s.selectedGroup.getTopObjects().filter((d) => d.isNode)[c(471)]((d) => {
        d.x += 1;
      });
    }), a(r.Move_up, (l) => {
      s.selectedGroup.getTopObjects().filter((c) => c.isNode).forEach((c) => {
        c.y -= 1;
      });
    }), a(r.Move_down, (l) => {
      const c = t;
      s.selectedGroup.getTopObjects().filter((d) => d.isNode)[c(471)]((d) => {
        d.y += 1;
      });
    }), a(r[t(486)], (l) => {
      e.layoutManager.doGridLayout();
    }), a(r.Cancel, (l) => {
      e.onEsc(l);
    });
  }
}
function Xt(n, t) {
  const e = Kt();
  return (Xt = function(s, i) {
    return e[s -= 236];
  })(n, t);
}
function Kt() {
  const n = ["7986363rkqSpn", "22464edatrB", "layoutManager", "evenSpacing", "22572PVuxit", "align", "target", "addEventListener", "739902GTyQRR", "移至底部", "148AqgGfl", "2466084uCyjqb", "parent", "editorEventManager", "select", "zIndex", "1747765wBpabb", "updateZIndex", "copyHandler", "376WvJyWc", "1146562ADlEAp", "clipboardManager", "update", "水平中心对齐", "底部对齐"];
  return (Kt = function() {
    return n;
  })();
}
(function() {
  const n = Xt, t = Kt();
  for (; ; )
    try {
      if (parseInt(n(253)) / 1 + parseInt(n(241)) / 2 + -parseInt(n(237)) / 3 * (-parseInt(n(243)) / 4) + -parseInt(n(249)) / 5 + parseInt(n(244)) / 6 + -parseInt(n(258)) / 7 + -parseInt(n(252)) / 8 * (parseInt(n(259)) / 9) === 598141)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
(function() {
  for (var n = qt, t = Qt(); ; )
    try {
      if (parseInt(n(446)) / 1 + -parseInt(n(450)) / 2 * (-parseInt(n(455)) / 3) + parseInt(n(454)) / 4 * (parseInt(n(456)) / 5) + parseInt(n(452)) / 6 * (-parseInt(n(449)) / 7) + parseInt(n(451)) / 8 + parseInt(n(447)) / 9 * (-parseInt(n(445)) / 10) + -parseInt(n(448)) / 11 === 432333)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class St {
  constructor() {
    this.take = 0;
  }
  copyPut(t) {
    this.take = 0, this.type = "copy", this.source = t;
  }
  cutPut(t) {
    this.take = -1, this.type = "cut", this.source = t;
  }
  takeSource() {
    var t = qt;
    return this.take++, this[t(453)];
  }
  isFirstCutPaste() {
    return this.type == "cut" && this.take == 0;
  }
}
function qt(n, t) {
  var e = Qt();
  return (qt = function(s, i) {
    return e[s -= 445];
  })(n, t);
}
function Qt() {
  var n = ["8162110VXYrWo", "73906elxyGe", "5374CFoDIn", "4163440fyitXC", "336gQSGJD", "source", "56cpmDRg", "681VAqjDi", "188655HVMDGs", "10pMHAsV", "426200BAFsuO", "2872998WoqyUZ"];
  return (Qt = function() {
    return n;
  })();
}
const O = it;
function it(n, t) {
  const e = Zt();
  return (it = function(s, i) {
    return e[s -= 282];
  })(n, t);
}
(function() {
  const n = it, t = Zt();
  for (; ; )
    try {
      if (parseInt(n(301)) / 1 + -parseInt(n(291)) / 2 * (-parseInt(n(285)) / 3) + parseInt(n(288)) / 4 * (-parseInt(n(309)) / 5) + -parseInt(n(284)) / 6 + parseInt(n(286)) / 7 + -parseInt(n(300)) / 8 + -parseInt(n(283)) / 9 * (-parseInt(n(310)) / 10) === 187109)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ue {
  constructor(t) {
    const e = it;
    this.cssClipBoard = new St(), this.clipboard = new St(), this.cssClipBoard = new St(), this[e(292)] = t;
  }
  copyHandler() {
    const t = it;
    let e = this[t(292)][t(305)], s = [][t(294)](e.selectedGroup.getTopObjects());
    if (s.length == 0)
      return;
    let i = s[t(299)]((r) => r.parent);
    this.clipboard.copyPut({ type: "objects", parents: i, sourceObjArr: s });
    let o = new M(t(306), { target: s });
    this[t(292)].dispatchEvent(o);
  }
  [O(289)]() {
    const t = O;
    let e = this.editor, s = e.stage, i = [][t(294)](s.selectedGroup.getTopObjects());
    if (i[t(290)] == 0)
      return;
    let o = i[t(299)]((a) => a.parent);
    this.clipboard.cutPut({ type: "objects", parents: o, sourceObjArr: i }), e.record("剪切"), i.forEach((a, l) => {
      o[l].removeChild(a), F.unlinks(a, i);
    }), e.recordEnd("剪切"), s.inputSystem._clearTarget(), e.connectBox.clearTarget(), e.nodeResizeBox.clearTarget(), e[t(312)].clearTarget();
    let r = new M(t(304), { target: i });
    this.editor.dispatchEvent(r);
  }
  pasteHandler() {
    const t = O;
    let e = this.editor, s = e.stage[t(302)], i = this.clipboard.takeSource();
    if (i == null)
      return;
    let o = e.stage, r = i.sourceObjArr, a = i.parents;
    a = a.map((m) => {
      const f = t;
      let v = o[f(311)][f(293)][f(303)];
      return v == null || v.contains(m) ? m : o.camera.localView.object;
    });
    let l = r[t(299)]((m) => m._obb.aabb), c = be.unionRects(l).getCenter(), d = s.xInWorld - c.x, h = s.yInWorld - c.y;
    e.record("粘贴");
    let p = r, u = o.serializerSystem.objectsToJSON(r);
    p = o.serializerSystem.jsonToObjects(u), p.forEach((m, f) => {
      m.translateWith(d, h);
    }), p[t(295)]((m, f) => {
      a[f].addChild(m);
    }), e.recordEnd("粘贴");
    let g = new M("paste", { target: p });
    this.editor.dispatchEvent(g);
  }
  [O(307)]() {
    const t = O;
    let e = this.editor[t(305)], s = e.inputSystem.target;
    s == null && (!e.selectedGroup.isEmpty() && (s = e.selectedGroup.objects[0]), s == null) || this.cssClipBoard[t(297)]({ type: "style", parents: [s[t(287)]], sourceObjArr: [s] });
  }
  [O(282)]() {
    const t = O;
    let e = this.editor, s = this[t(298)].takeSource();
    if (s == null || s[t(313)].length == 0)
      return;
    let i = e.stage.selectedGroup.objects, o = this;
    e[t(308)]("粘贴样式");
    let r = s[t(313)][0];
    i.forEach((a) => {
      o.copySetStyle(a, r);
    }), e.recordEnd("粘贴样式");
  }
  copySetStyle(t, e) {
    const s = O;
    if (t !== e && t.className == e.className) {
      for (let i = 0; i < e.classList.length; i++)
        t[s(296)][i] = e.classList[i];
      t.setStyles(e.style);
    }
  }
}
function Zt() {
  const n = ["copyPut", "cssClipBoard", "map", "2799832Rwzysd", "12803bOiDtN", "inputSystem", "object", "cut", "stage", "copy", "styleCopyHandler", "record", "1653555XOGyDA", "10LsPGVS", "camera", "linkCtrlBox", "sourceObjArr", "stylePasteHandler", "1816929VvCbHv", "271254ACmMeV", "3LaMkEA", "2372979KcAGrb", "parent", "4XeysvS", "cutHandler", "length", "718654Mgntmv", "editor", "localView", "concat", "forEach", "classList"];
  return (Zt = function() {
    return n;
  })();
}
function $t() {
  const n = ["31404oGsdtJ", "rotate", "translate", "resize", "151428IFhZeG", "4536590ZRZcyZ", "center", "updateSize", "133LIVKZh", "3113zQWKNi", "camera", "style", "hide", "2750DbNAGy", "viewClone", "155yTiVFr", "30890RnPsjx", "76csOyte", "atan2", "4923tkKGlw", "3427383OKpGBM", "12656BhHlaB", "currObject", "editor"];
  return ($t = function() {
    return n;
  })();
}
const lt = rt;
function rt(n, t) {
  const e = $t();
  return (rt = function(s, i) {
    return e[s -= 213];
  })(n, t);
}
(function() {
  const n = rt, t = $t();
  for (; ; )
    try {
      if (parseInt(n(219)) / 1 * (parseInt(n(217)) / 2) + -parseInt(n(224)) / 3 + parseInt(n(221)) / 4 * (-parseInt(n(220)) / 5) + -parseInt(n(232)) / 6 * (-parseInt(n(236)) / 7) + parseInt(n(225)) / 8 * (parseInt(n(223)) / 9) + -parseInt(n(233)) / 10 + parseInt(n(213)) / 11 * (parseInt(n(228)) / 12) === 585110)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Je extends k {
  constructor(t, e = 0, s = 0, i = 1, o = 1) {
    const r = rt;
    super(null, e, s, i, o), this.zIndex = ft.NodeCtrlBox, this.editor = t, this.setStyles(I.dropBox[r(215)]), this.pointerEnabled = !1, this.currObject, this[r(216)]();
  }
  update() {
    this.visible && this.currObject != null && this.updateSize();
  }
  attachTo(t) {
    const e = rt;
    return t == null || t instanceof k && !this.editor.isEditable(t) ? (this[e(226)] = null, void this.hide()) : (this.currObject = t, this.updateSize(), void this.show());
  }
  [lt(235)]() {
    const t = lt;
    this[t(226)] != null && this[t(218)](this[t(226)]);
  }
  [lt(218)](t) {
    const e = lt;
    let s = this[e(227)].stage;
    if (t instanceof kt)
      return this.resize(s.width - 10, s.height - 10), this.rotate(0), void this[e(230)](0.5 * s.width, 0.5 * s.height);
    if (!(t instanceof x) && t instanceof k) {
      let i = s[e(214)].getObjectScreenTransform(t), o = i.point(t._positionToLocalPoint(b[e(234)])), r = i.point(t._positionToLocalPoint(b.rm)), a = Math[e(222)](r.y - o.y, r.x - o.x);
      i[e(229)](-a);
      let l = i.point(t._positionToLocalPoint(b.center)), c = i.point(t._positionToLocalPoint(b.rb)), d = 2 * (c.x - l.x), h = 2 * (c.y - l.y), p = 4;
      this[e(231)](d + 2 * p, h + 2 * p), this[e(229)](a), this.translate(o.x, o.y);
    }
  }
}
function te() {
  const n = ["visible", "2931318ibbGtl", "9312440uPYAbC", "stage", "isSelected", "68zbZIje", "47674dFgOGO", "752417tEDjHj", "16smhStJ", "pointerEnabled", "3770206RIDyzQ", "30sAEztj", "getAllNodes", "52615aZqCLj", "54QAUmwQ", "parent", "filter", "827155slacho"];
  return (te = function() {
    return n;
  })();
}
function fe(n, t) {
  const e = bt;
  let s, i = n.stage.getCurrentLayer(), o = n[e(274)].camera, r = i[e(283)]().filter((l) => {
    const c = e;
    let d = l;
    return d[c(271)] && d[c(275)] != 1 && d[c(280)] && o.canSee(d);
  }), a = t[e(269)]((l) => {
    const c = e;
    return l.isOutOfParent() || l[c(268)] === i;
  });
  for (let l = 0; l < a.length && (s = Ye(a[l], r), s == null); l++)
    ;
  return s == null && (s = i, a = a.filter((l) => l.parent !== i)), { parent: s, objects: a };
}
function bt(n, t) {
  const e = te();
  return (bt = function(s, i) {
    return e[s -= 267];
  })(n, t);
}
function Ye(n, t) {
  const e = bt, s = n.getAABB(), i = t[e(269)]((o) => o !== n.parent && o !== n && !n.contains(o));
  for (let o = i.length - 1; o >= 0; o--) {
    const r = i[o];
    if (r.getAABB().isIntersectRect(s))
      return r;
  }
  return null;
}
(function() {
  const n = bt, t = te();
  for (; ; )
    try {
      if (parseInt(n(278)) / 1 + -parseInt(n(277)) / 2 * (parseInt(n(282)) / 3) + parseInt(n(276)) / 4 * (-parseInt(n(284)) / 5) + -parseInt(n(267)) / 6 * (-parseInt(n(270)) / 7) + -parseInt(n(279)) / 8 * (-parseInt(n(272)) / 9) + -parseInt(n(273)) / 10 + -parseInt(n(281)) / 11 === 776055)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const C = ee;
function ee(n, t) {
  const e = ne();
  return (ee = function(s, i) {
    return e[s -= 255];
  })(n, t);
}
function ne() {
  const n = ["isDragEnd", "charAt", "10195rowbeH", "stage", "3JCCGDY", "objects", "4909839pCzTPP", "dblclickHandler", "button", "clearTarget", "getTopObjects", "round", "editor", "1206DWdEhy", "pointerdown", "event", "pointeroutStageHandler", "record", "_dragHandler", "pointeroutHandler", "keyboard", "isPointerOn", "91481YVJAbV", "attachTo", "121340iQJixB", "linkCtrlBox", "2508eYAqWz", "isDragStart", "handlerLayer", "dropToBox", "dragend", "isConnectable", "selectedGroupDragEndHandler", "14FACegD", "alignManager", "对象拖拽", "controlTarget", "10251110VUwkGs", "hide", "removeChild", "currObject", "isKeydown", "1DZtGPS", "pointerenterHandler", "connectBox", "addEventListener", "isEditable", "deleteHandler", "控制点", "pointerenterStageHandler", "selectedGroupDragHandler", "preventDefault", "mouseOverTarget", "addChild", "popupMenu", "2273420WZAEzB", "843536aoYlAK", "setCursor", "parent", "nodeResizeBox", "_pickUp", "inputSystem", "removeAll", "aabb", "9qRXQMZ", "target"];
  return (ne = function() {
    return n;
  })();
}
(function() {
  const n = ee, t = ne();
  for (; ; )
    try {
      if (-parseInt(n(267)) / 1 * (parseInt(n(315)) / 2) + parseInt(n(295)) / 3 * (parseInt(n(280)) / 4) + -parseInt(n(293)) / 5 * (-parseInt(n(304)) / 6) + -parseInt(n(258)) / 7 * (parseInt(n(281)) / 8) + -parseInt(n(289)) / 9 * (parseInt(n(262)) / 10) + -parseInt(n(297)) / 11 + -parseInt(n(317)) / 12 * (-parseInt(n(313)) / 13) === 705913)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Xe = ce.w != null ? ce.w[C(292)](3) : "1";
class Ke {
  constructor(t) {
    this.editor = t, this.init();
  }
  init() {
    const t = C;
    let e = this[t(303)], s = e.stage, i = s.inputSystem, o = e.handlerLayer;
    s.camera.localView.mode == null && (s[t(270)]("modechange", function(r) {
      const a = t;
      let l = r.mode, c = e[a(284)], d = e.linkCtrlBox, h = e[a(320)], p = e[a(269)];
      l == Te.edit ? (o[a(278)](c), o[a(278)](d), o.addChild(p), o.addChild(h)) : (o.removeChild(c), o[a(264)](d), o.removeChild(p), o[a(264)](h)), e.update();
    }), i.addEventListener("dragover", function(r) {
      r.preventDefault(), e.dispatchEvent(r);
    }), i.addEventListener("drop", function(r) {
      i.event.defaultPrevented || e.dispatchEvent(r);
    }), i.addEventListener(t(305), function(r) {
      const a = t;
      i.event.defaultPrevented || e.popupMenu[a(263)]();
    }), i.addEventListener("pointerup", function(r) {
      const a = t;
      i[a(299)] == 2 ? !i[a(291)] && e.popupMenu.showAt(i.x, i.y) : e[a(279)].hide();
    }), i.addEventListener("pointermove", function() {
    }), s.selectedGroup[t(270)](t(255), function(r) {
      const a = t;
      e.selectedGroupDragHandler(r, s.selectedGroup[a(301)]());
    }), s.selectedGroup[t(270)]("dragstart", function(r) {
      e.selectedGroupDragEndHandler(r, s.selectedGroup.getTopObjects());
    }));
  }
  [C(272)]() {
    const t = C;
    let e = this.editor, s = e.stage.selectedGroup;
    if (Xe != "1")
      return null;
    let i = s[t(301)]();
    s[t(287)](), e.connectBox.clearTarget(), e.nodeResizeBox.clearTarget(), e.linkCtrlBox.clearTarget(), e.instanceManager.delete(i), e.dispatchEvent(new M("delete", { target: i }));
  }
  pointerdownHandler(t) {
    const e = C, s = this.editor, i = s.stage.inputSystem;
    let o = s[e(319)], r = s.nodeResizeBox, a = s.linkCtrlBox;
    s.alignManager.pointerdownHandler(i);
    let l = o[e(285)]();
    if (s.controlTarget = l, s[e(269)][e(263)](), l != null) {
      let c = l[e(283)];
      return c !== r ? r[e(263)]() : c !== a && a.hide(), l.pointerdownHandler(i), void i.event[e(276)]();
    }
    a.hide(), r.hide();
  }
  mousewheelHandler(t) {
  }
  [C(298)](t) {
  }
  pointupHandler(t) {
    const e = C, s = this.editor, i = s.stage[e(286)];
    s.alignManager.pointerupHandler(i);
    let o = s[e(294)], r = s.nodeResizeBox, a = s[e(316)], l = s[e(261)];
    if (l != null)
      return i.isDragEnd && !(l instanceof ht) && s.recordEnd("控制点"), l.pointerupHandler(i), i.event.preventDefault(), void s.update();
    if (i[e(299)] == 2)
      return;
    let c = o[e(286)][e(290)];
    if (c != null ? (s.isEditable(c) && (c instanceof x ? a.attachTo(c) : c instanceof k && r[e(314)](c)), s.isConnectable(c) && s.connectBox.setTarget(c)) : (s.connectBox[e(300)](), r.clearTarget(), a[e(300)]()), s.dropToBox[e(265)] != null) {
      let d = s.selectedGroup.getTopObjects(), h = fe(s, d), p = h.parent;
      h[e(296)].forEach((u) => {
        u.changeParent(p), me._upgradeLinks(u).length;
      });
    }
    s.dropToBox.attachTo(null);
  }
  [C(309)](t) {
    const e = C, s = this.editor, i = s.stage.inputSystem;
    if (i.buttons == 2)
      return;
    s[e(311)][e(266)]("Shift") && s.stage[e(282)](w.crosshair);
    let o = s[e(261)];
    if (o != null)
      return i.isDragStart && !(o instanceof ht) && s[e(308)](e(273)), o.dragHandler(i), i[e(306)] instanceof MouseEvent && i.event.defaultPrevented == 1 ? void 0 : void i[e(306)][e(276)]();
    s[e(259)]._dragHandler(i), s.dropToBox.hide();
    const r = s.keyConfig.DropTo_leader;
    if (s.stage.inputSystem.target && s.keyboard.isKeydown(r)) {
      let a = s.selectedGroup.getTopObjects(), l = fe(s, a), c = l.parent;
      l[e(296)], c instanceof k && s[e(271)](c) ? s[e(320)][e(314)](c) : c instanceof kt && s[e(320)].attachTo(c);
    }
  }
  pointermoveHandler(t) {
    const e = C, s = this.editor;
    let i = s.stage;
    const o = i.handlerLayer;
    if (i.getCurrentLayer() == null || (i[e(282)](w.auto), s.keyboard[e(266)]("Control") && s.connectBox.findConnectableEndpoint([])))
      return;
    let r = o._pickUp();
    if (r !== s.mouseOverTarget && (s[e(277)] != null && s[e(277)][e(310)](t), r != null && r.pointerenterHandler(t)), s[e(277)] = r, r != null)
      return void r.pointermoveHandler(t);
    let a = i.getCurrentLayer()._pickUp();
    a != null && (s.stage.setCursor(w.move), a.isNode && s[e(256)](a) && s.connectBox.setTarget(a));
  }
  [C(268)](t) {
    const e = C, s = this.editor;
    s.linkCtrlBox.pointerenterStageHandler(), s[e(284)][e(274)](), s[e(269)][e(274)]();
  }
  [C(310)](t) {
    const e = C, s = this.editor;
    s.recordName != null && s.recordInterrupt(), s.linkCtrlBox[e(307)](), s.nodeResizeBox[e(307)](), s.connectBox.pointeroutStageHandler();
  }
  [C(275)](t, e) {
    const s = C, i = this[s(303)];
    if (i[s(294)].inputSystem[s(318)] && i.record(s(260)), e.length == 1) {
      const o = e[0];
      i.stage.camera.toScreenRect(o._obb[s(288)]).getCenter();
    }
  }
  [C(257)](t, e) {
    const s = C, i = this.editor;
    i.stage.inputSystem[s(312)] ? (e.forEach((o) => {
      const r = s;
      o.isNode && (o.x = Math[r(302)](o.x), o.y = Math[r(302)](o.y));
    }), i.recordEnd("对象拖拽")) : i.recordInterrupt();
  }
}
const ct = mt;
function se() {
  const n = ["evenSpacing", "filter", "92328WQcRJK", "getTopObjects", "移至底部", "84411Grwfza", "160536hvgTeb", "map", "resize", "左对齐", "pointsLayout", "stage", "下移一层", "8jypRSf", "65KTTCJV", "20dkDUzq", "148662ShBAKH", "moveToHead", "顶部对齐", "bottom", "270aPtHVP", "translate", "translateWith", "32vfUOUO", "selectedGroup", "43574YJVYxu", "sqrt", "5085458kiJpji", "585109GbPbQK", "253SDSLoQ", "75tBmVPQ", "水平中心对齐", "center", "length", "middle"];
  return (se = function() {
    return n;
  })();
}
(function() {
  const n = mt, t = se();
  for (; ; )
    try {
      if (parseInt(n(198)) / 1 * (-parseInt(n(208)) / 2) + -parseInt(n(189)) / 3 * (parseInt(n(206)) / 4) + parseInt(n(213)) / 5 * (-parseInt(n(199)) / 6) + -parseInt(n(211)) / 7 * (-parseInt(n(196)) / 8) + -parseInt(n(188)) / 9 * (parseInt(n(203)) / 10) + -parseInt(n(212)) / 11 * (parseInt(n(185)) / 12) + -parseInt(n(197)) / 13 * (-parseInt(n(210)) / 14) === 234136)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class qe {
  constructor(t) {
    this.editor = t;
  }
  changeLevel(t, e) {
    const s = mt;
    e == "上移一层" ? F.swapWithRight(t) : e == s(195) ? F.swapWithLeft(t) : e == "移至顶部" ? F.moveToTail(t) : e == s(187) && F[s(200)](t), t.parent.updateZIndex();
  }
  [ct(218)](t) {
    const e = ct;
    let s = this.editor[e(194)][e(207)].getTopObjects();
    s = s[e(219)]((i) => i.isNode || i instanceof x && ye(i)), s.length;
  }
  align(t) {
    const e = ct, s = this.editor;
    let i = s.stage.selectedGroup.getTopObjects();
    if (i = i.filter((a) => a.isNode || a instanceof x && ye(a)), i[e(216)] == 0)
      return;
    let o = i[e(190)]((a) => a._obb.aabb), r = be.unionRects(o);
    for (let a = 0; a < i[e(216)]; a++) {
      let l = i[a], c = l._obb.aabb;
      t == e(192) ? l.translateWith(r.x - c.x, 0) : t == "右对齐" ? l[e(205)](r.right - c.right, 0) : t == e(201) ? l.translateWith(0, r.y - c.y) : t == "底部对齐" ? l[e(205)](0, r.bottom - c[e(202)]) : t == e(214) ? l[e(205)](0, r[e(217)] - c[e(217)]) : t == "垂直中心对齐" && l.translateWith(r[e(215)] - c.center, 0);
    }
    s.update();
  }
  doGridLayout() {
    const t = ct;
    let e = this.editor[t(194)], s = e.selectedGroup[t(186)]()[t(219)]((c) => c instanceof k);
    if (s[t(216)] < 2)
      return;
    let i = Math.ceil(Math[t(209)](s.length)), o = me.getUnionRect(s).getCenter(), r = Ee.grid(i, i), a = e.layoutSystem[t(193)](s, r), l = s[0].width * i;
    a[t(191)](l, l), a[t(204)](o.x, o.y), a.doLayout({ effect: "easeInQuart", duration: 300 });
  }
}
function mt(n, t) {
  const e = se();
  return (mt = function(s, i) {
    return e[s -= 185];
  })(n, t);
}
function ye(n) {
  return !n.begin.isDisplayObjectHost() && !n.end.isDisplayObjectHost();
}
const q = xt;
function ie() {
  const n = ["newInstance", "getCurrentLayer", "function", "60VlLmxq", "showOpTooltip", "editor", "setEnd", "_addNewInstance", "5714667RDcnNW", "localView", "assign", "includes", "4270200UnxRqT", "2obhAcX", "dispatchEvent", "setBegin", "getObject", "forEach", "19270630BqDWht", "unknow classname:", "332BGOLsV", "22790BVocmX", "9325576xYRwuY", "243194rfdWoc", "create", "getMouseXY", "932231HIpHiT", "addChild", "height"];
  return (ie = function() {
    return n;
  })();
}
function xt(n, t) {
  const e = ie();
  return (xt = function(s, i) {
    return e[s -= 190];
  })(n, t);
}
(function() {
  const n = xt, t = ie();
  for (; ; )
    try {
      if (-parseInt(n(210)) / 1 * (-parseInt(n(197)) / 2) + -parseInt(n(196)) / 3 + -parseInt(n(204)) / 4 * (-parseInt(n(205)) / 5) + -parseInt(n(216)) / 6 * (parseInt(n(207)) / 7) + -parseInt(n(206)) / 8 + parseInt(n(192)) / 9 + parseInt(n(202)) / 10 === 936054)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Qe {
  constructor(t) {
    this.editor = t;
  }
  delete(t) {
    const e = xt;
    let s = this[e(218)];
    s.record("删除"), t[e(201)](function(i) {
      F.unlinks(i), i.removeFromParent();
    });
    {
      let i = s.stage.camera.localView, o = i.getObject();
      o && !(o instanceof kt) && t[e(195)](o) && i.quit();
    }
    s[e(217)]("删除"), s.recordEnd("删除");
  }
  [q(191)](t) {
    const e = q;
    this.editor.stage.camera[e(193)][e(200)]().addChild(t);
  }
  [q(208)](t) {
    const e = q;
    let s = this.editor.stage.camera.localView[e(209)](), i = s.x, o = s.y, r = he.newInstance(t);
    if (r instanceof k)
      return r.x = i, r.y = o, r.width = 64, r[e(212)] = 64, this._addNewInstance(r), r;
    if (r instanceof x)
      return r[e(199)]({ x: i - 40, y: o }), r[e(190)]({ x: i + 40, y: o + (t == "Link" ? 0 : 80) }), this._addNewInstance(r), r;
    throw new Error(e(203) + t);
  }
  lineDrawn(t, e, s) {
    const i = q;
    let o = this[i(218)], r = he[i(213)](o.LinkClassName);
    r.setBegin(s), r[i(190)](e);
    const a = Object[i(194)]({}, o.newLinkProperties);
    a.css && (r.setStyles(a.css), delete a.css), Object.keys(a)[i(201)]((c) => {
      const d = i;
      let h = a[c];
      typeof h == d(215) ? r[c] = h() : r[c] = h;
    });
    let l = t.isNode || t.isLink ? t.parent : o[i(214)]();
    return r.zIndex = ft.EditorNewLink, l[i(211)](r), o.dispatchEvent(new M("linkbegin", { target: r })), r;
  }
  lineDrawingFinished(t) {
    const e = q;
    let s = new M("linkend", { target: t });
    this[e(218)][e(198)](s);
  }
}
function U(n, t) {
  const e = re();
  return (U = function(s, i) {
    return e[s -= 500];
  })(n, t);
}
const N = U;
function re() {
  const n = ["findAlignRectInfo", "align", "stage", "setEnd", "MAX_VALUE", "setStyles", "max", "setBegin", "hide", "selectedGroup", "invert", "minDistance", "parent", "top", "middle", "dxLine", "visible", "2780792YfPfvK", "pointerupHandler", "right", "_obb", "round", "2688438KyGwHs", "addChild", "verticalType", "_disabled", "_dragHandler", "7810335oGlkkb", "bottom", "dyLine", "getAlignInfo", "show", "481518SBcpYI", "abs", "getCurrentLayer", "toScreenRect", "6afeUHj", "center", "7nlcLMg", "vec", "alignInfo", "27747euuTcu", "horizontalType", "1705524FAtMLB", "editor", "aabb", "left", "2346555AYwPzF"];
  return (re = function() {
    return n;
  })();
}
(function() {
  const n = U, t = re();
  for (; ; )
    try {
      if (parseInt(n(536)) / 1 + -parseInt(n(527)) / 2 * (parseInt(n(531)) / 3) + -parseInt(n(538)) / 4 + parseInt(n(542)) / 5 + -parseInt(n(517)) / 6 + -parseInt(n(533)) / 7 * (-parseInt(n(512)) / 8) + parseInt(n(522)) / 9 === 356500)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ze {
  constructor(t) {
    const e = U;
    this[e(520)] = !1, this[e(511)] = !1, this.editor = t, this.init(t);
  }
  init(t) {
    const e = U;
    this[e(535)] = { horizontalType: null, verticalType: null, horizontalTarget: null, verticalTartet: null };
    let s = new x(null, { x: 0, y: 0 }, { x: 100, y: 100 });
    s[e(500)](I[e(544)].alignLineStyle), s.pointerEnabled = !1, this.dxLine = s;
    let i = new x(null, { x: 0, y: 0 }, { x: 100, y: 100 });
    i.setStyles(I.align.alignLineStyle), i.pointerEnabled = !1, this.dyLine = i, s[e(503)](), i[e(503)](), t.handlerLayer[e(518)](s), t.handlerLayer[e(518)](i);
  }
  disable() {
    const t = U;
    this._disabled = !0, this[t(510)].hide(), this[t(524)].hide();
  }
  enable() {
    this[U(520)] = !1;
  }
  [N(525)](t, e) {
    const s = N, i = this[s(539)].stage;
    let o = t.target;
    if (i[s(504)].objects.length > 1)
      return this.alignInfo.horizontalType = null, this.alignInfo.verticalType = null, this.alignInfo.horizontalTarget = null, this.alignInfo.verticalTartet = null, this.alignInfo;
    let r = J.aliagnAble(o, o);
    const a = i[s(529)]().displayList.filter(r);
    let l = this.editor.stage.camera.scale * e;
    return this[s(543)](o._obb.aabb, a, l);
  }
  pointerdownHandler(t) {
    const e = N;
    this.dxLine.hide(), this[e(524)].hide();
  }
  [N(513)](t) {
    const e = N;
    if (this._disabled)
      return;
    let s = t.previous, i = this.dxLine.visible || this[e(524)].visible;
    if (s.type !== "pointermove" || i == 0)
      return;
    this.dxLine.hide(), this.dyLine[e(503)]();
    let o = t.target;
    if (o == null || !J.isAlignable(this[e(539)]))
      return;
    const r = Math[e(501)](1, I[e(544)].gridSize);
    let a = o._obb.aabb, l = this[e(535)];
    if (l[e(537)] != null) {
      let c = o[e(507)].getWorldTransform().invert(), d = l.horizontalTarget._obb[e(540)][l[e(537)]] - a[l.horizontalType];
      if (d != 0) {
        let h = c[e(534)]([1, 1], [d, 1]);
        o.x += h[0];
      }
    } else
      o.x = Math.round(o.x / r) * r;
    if (l.verticalType != null) {
      let c = o[e(507)].getWorldTransform()[e(505)](), d = l.verticalTartet._obb.aabb[l.verticalType] - a[l[e(519)]];
      if (d != 0) {
        let h = c.vec([1, 1], [1, d]);
        o.y += h[1];
      }
    } else
      o.y = Math[e(516)](o.y / r) * r;
  }
  [N(521)](t) {
    const e = N;
    if (this._disabled)
      return;
    let s = t.target;
    if (s == null || !s.isNode || (this.dxLine[e(503)](), this.dyLine.hide(), !J.isAlignable(this.editor)))
      return;
    let i = this[e(510)], o = this.dyLine;
    const r = Math[e(501)](0, I.align[e(506)]);
    r == 0 ? (this[e(535)].horizontalType = null, this.alignInfo[e(519)] = null, this.alignInfo.horizontalTarget = null, this[e(535)].verticalTartet = null) : this.alignInfo = this.getAlignInfo(t, r);
    const a = this.alignInfo, l = Math.max(1, I[e(544)].gridSize);
    let c = s._obb.aabb, d = { x: Math.round(c.center / l) * l, y: Math[e(516)](c.middle / l) * l }, h = this.editor[e(545)].camera.toScreenXY(d.x, d.y);
    if (a[e(537)] != null) {
      let p = this.editor.stage.camera[e(530)](s._obb[e(540)]), u = this.editor[e(545)].camera.toScreenRect(a.horizontalTarget[e(515)].aabb), g = u[a.horizontalType], m = (p.middle + u.middle) / 2, f = Math.abs(p.middle - u[e(509)]);
      i.setBegin({ x: g, y: m - f / 2 }), i.setEnd({ x: g, y: m + f / 2 }), i[e(526)]();
    } else {
      let p = h.x, u = h.y, g = l;
      i.setBegin({ x: p, y: u - g / 2 }), i.setEnd({ x: p, y: u + g / 2 }), i.show();
    }
    if (a.verticalType != null) {
      let p = this.editor.stage.camera.toScreenRect(s._obb.aabb), u = this.editor.stage.camera.toScreenRect(a.verticalTartet._obb.aabb), g = (p[e(532)] + u.center) / 2, m = u[a.verticalType], f = Math[e(528)](p.center - u[e(532)]);
      o.setBegin({ x: g - f / 2, y: m }), o[e(546)]({ x: g + f / 2, y: m }), o.show();
    } else {
      let p = h.x, u = h.y, g = l;
      o[e(502)]({ x: p - g / 2, y: u }), o.setEnd({ x: p + g / 2, y: u }), o[e(526)]();
    }
  }
  findAlignRectInfo(t, e, s) {
    const i = N;
    e.map((p) => p._obb.aabb);
    let o, r, a, l, c = Number[i(547)], d = Number.MAX_VALUE;
    e.sort((p, u) => {
      const g = i;
      return nt.distance(t[g(532)], t.middle, u._obb.aabb.center, u._obb.aabb.middle) - nt.distance(t[g(532)], t.middle, p._obb[g(540)].center, p._obb[g(540)].middle);
    });
    let h = 0;
    for (let p = 0; p < e.length; p++) {
      let u = e[p], g = u._obb[i(540)];
      g.isIntersectRect(t) || (h = Math[i(528)](t.top - g[i(508)]), h <= d && h <= s && (l = "top", r = u, d = h), h = Math.abs(t[i(523)] - g.bottom), h <= d && h <= s && (l = "bottom", r = u, d = h), h = Math[i(528)](t.middle - g[i(509)]), h <= d && h <= s && (l = "middle", r = u, d = h), h = Math.abs(t[i(541)] - g.left), h <= c && h < s && (a = "left", o = u, c = h), h = Math.abs(t[i(514)] - g.right), h <= c && h < s && (a = "right", o = u, c = h), h = Math.abs(t.center - g[i(532)]), h <= c && h < s && (a = "center", o = u, c = h));
    }
    return { horizontalType: a, verticalType: l, horizontalTarget: o, verticalTartet: r };
  }
}
const Q = vt;
function vt(n, t) {
  const e = oe();
  return (vt = function(s, i) {
    return e[s -= 220];
  })(n, t);
}
function oe() {
  const n = ["2663DfJgFU", "802275fUYxhm", "2285202bjCyTB", "hide", "8256116pwmuti", "editor", "enable", "show", "guidLineW", "3859884MdiSmX", "9gfcBfL", "crossGuildLine", "154UfCNKB", "styleV", "handlerLayer", "5OWlhwn", "guildlineH", "20eeIHMB", "guildlineV", "2599114pVpMyi", "2815760AVfFvN", "init"];
  return (oe = function() {
    return n;
  })();
}
(function() {
  const n = vt, t = oe();
  for (; ; )
    try {
      if (parseInt(n(220)) / 1 * (parseInt(n(232)) / 2) + -parseInt(n(221)) / 3 + -parseInt(n(229)) / 4 + -parseInt(n(235)) / 5 * (parseInt(n(222)) / 6) + parseInt(n(239)) / 7 + -parseInt(n(240)) / 8 * (-parseInt(n(230)) / 9) + parseInt(n(237)) / 10 * (parseInt(n(224)) / 11) === 816172)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class $e {
  constructor(t) {
    const e = vt;
    this._disabled = !0, this[e(225)] = t;
  }
  [Q(241)]() {
    const t = Q, e = this.editor[t(234)], s = new x();
    s.name = t(228), s.pointerEnabled = !1, s.setStyles(I[t(231)].styleH), s[t(223)](), this.guildlineH = s, e.addChild(this.guildlineH);
    const i = new x();
    i.name = "guidLineS", i.pointerEnabled = !1, i.setStyles(I.crossGuildLine[t(233)]), i.hide(), this.guildlineV = i, e.addChild(this[t(238)]);
  }
  disable() {
    this._disabled = !0, this.hideGuidLine();
  }
  [Q(226)]() {
    const t = Q;
    this._disabled = !1, this[t(236)] == null && this.init();
  }
  updateGuildLine() {
    const t = Q;
    if (this._disabled)
      return;
    const e = this.editor.stage, s = this[t(236)], i = this[t(238)], o = e.inputSystem, r = o.x, a = o.y;
    s.setBegin({ x: 0, y: a }), s.setEnd({ x: e.width, y: a }), s.show(), i.setBegin({ x: r, y: 0 }), i.setEnd({ x: r, y: e.height }), i[t(227)]();
  }
  hideGuidLine() {
    const t = Q;
    this.guildlineH.hide(), this[t(238)].hide();
  }
}
const y = ot;
function ae() {
  const n = ["instanceManager", "isConnectable", "8uZpVWe", "render", "19656BJmbyS", "opTooltip", "20px", "removeEventListener", "localView", "fromJSON", "disableEdit", "_restoreFromState", "297760kjrspF", "getItem", "1199NKqrlO", "stage", "drop", "handlerLayer", "serializerSystem", "pointerenterHandler", "update", "DataCenter", "controlTarget", "lastLayerState", "nodeResizeBox", "pointerCrossLineManager", "hasListener", "6840837VoYWVl", "localLastDocName", "set", "pointerupHandler", "push", "setEditable", "pointerdownHandler", "alignManager", "delete", "style", "mousewheelHandler", "keyboard", "getBoundingClientRect", "left", "LinkClassName", "isDraging", "keyManager", "record", "843662NcJjqX", "_dragHandler", "6ktpCmF", "editorEventManager", "4594295AJvAXk", "showAt", "selectedGroupDragEndHandler", "isEditable", "372598kzWQCC", "domElement", "dispatchEvent", "1213164EDHUYW", "parent", "432vEqOQL", "top", "camera", "toJSON", "_clearTarget", "recordName", "redoUndoSys", "dblclickHandler", "defineKeys", "_getState", "getCurrentLayer", "updateGuildLine", "connectBox", "save"];
  return (ae = function() {
    return n;
  })();
}
function ot(n, t) {
  const e = ae();
  return (ot = function(s, i) {
    return e[s -= 161];
  })(n, t);
}
(function() {
  const n = ot, t = ae();
  for (; ; )
    try {
      if (parseInt(n(162)) / 1 + -parseInt(n(226)) / 2 * (parseInt(n(228)) / 3) + -parseInt(n(165)) / 4 + -parseInt(n(230)) / 5 + parseInt(n(167)) / 6 * (-parseInt(n(185)) / 7) + -parseInt(n(183)) / 8 * (parseInt(n(208)) / 9) + parseInt(n(193)) / 10 * (parseInt(n(195)) / 11) === 590101)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class tn extends Ie {
  constructor(t) {
    const e = ot;
    super(), this.existObjectMap = /* @__PURE__ */ new WeakMap(), this.keyConfig = ut, this.config = I, this[e(222)] = "AutoFoldLink", this.newLinkProperties = {}, this.DataCenter = Re, this.imageToBase64 = !1, this._disableEditMap = /* @__PURE__ */ new Map(), this._disableConnectMap = /* @__PURE__ */ new Map(), this.stage = t, t.editor = this, this.handlerLayer = t.handlerLayer, this.selectedGroup = this.stage.selectedGroup, this[e(219)] = t.keyboard, this.clipboardManager = new Ue(this), this.instanceManager = new Qe(this), this[e(229)] = new Ke(this), this[e(224)] = new Ve(this), this.nodeResizeBox = new je(this), this.linkCtrlBox = new _e(this), this.connectBox = new Ge(this), this.dropToBox = new Je(this), this.popupMenu = function(s) {
      const i = Xt, o = s.stage;
      let r = new Pe(o, `
<div class="header">编辑</div>
<a>剪切</a>
<a>复制</a>
<a>粘贴</a>
<a>删除</a> 
<hr></hr>
<div class="header">前后</div>
<a>上移一层</a>
<a>下移一层</a>
<a>移至顶部</a>
<a>移至底部</a>
<div class="header">对齐</div>
<a>左对齐</a>
<a>右对齐</a>
<a>顶部对齐</a>
<a>底部对齐</a>
<a>水平中心对齐</a>
<a>垂直中心对齐</a>
`);
      return r[i(240)](i(247), function(a) {
        const l = i, c = a.item;
        let d = o.inputSystem[l(239)];
        c == "剪切" ? s[l(254)].cutHandler() : c == "复制" ? s.clipboardManager[l(251)]() : c == "粘贴" ? s.clipboardManager.pasteHandler() : c == "删除" && s[l(246)].deleteHandler(), d != null && (c == "上移一层" ? s.layoutManager.changeLevel(d, c) : c == "下移一层" || c == "移至顶部" ? s[l(260)].changeLevel(d, c) : c == l(242) ? s.layoutManager.changeLevel(d, c) : c == "左对齐" ? s.layoutManager[l(238)]("左对齐") : c == "右对齐" ? s[l(260)][l(238)]("右对齐") : c == "顶部对齐" ? s[l(260)].align("顶部对齐") : c == l(257) ? s.layoutManager.align("底部对齐") : c == "水平中心对齐" ? s[l(260)].align(l(256)) : c == "垂直中心对齐" ? s[l(260)].align("垂直中心对齐") : c == "左右等距" ? s[l(260)][l(236)]("左右等距") : c == "上下等距" && s.layoutManager.evenSpacing("上下等距"), d.zIndex < 0 ? d.zIndex = 0 : d[l(248)] > 1e3 && (d.zIndex = 1e3), d.parent != null && d[l(245)][l(250)](), s[l(255)]());
      }), r;
    }(this), this.stage.inputSystem[e(171)](), this[e(203)] = null, this.mouseOverTarget = null, this.inputTextfield = new Ae(t), this.redoUndoSys = new Fe(this), this.layoutManager = new qe(this), this[e(215)] = new Ze(this), this.opTooltip = new He(t), Object.assign(this.opTooltip[e(163)][e(217)], { paddingLeft: e(187), paddingRight: "20px", color: "black" }), this[e(206)] = new $e(this);
  }
  setLinkClassName(t) {
    this.LinkClassName = t;
  }
  [y(177)]() {
    const t = y;
    return this.stage[t(177)]();
  }
  [y(175)](t) {
    Object.assign(this.keyConfig, t);
  }
  showOpTooltip(t) {
    const e = y;
    I.operationTip.enable && (this.opTooltip.setHtml(t), this[e(186)][e(231)](0.5 * this[e(196)].width, 0.5 * this.stage.height), this.opTooltip.fadeOut());
  }
  saveHandler(t, e = !1) {
    const s = y;
    let i = this;
    if (e == 1)
      return void this.stage.toJSONWithBase64().then((a) => {
        const l = ot;
        let c = JSON.stringify(a);
        this.DataCenter.setItem(I.data[l(209)], c), i.dispatchEvent(new M(l(180), { details: { imageToBase64: e, json: c } }));
      });
    let o = this.stage[s(170)](), r = JSON.stringify(o);
    this[s(202)].setItem(I.data.localLastDocName, r), i[s(164)](new M("save", { details: { imageToBase64: e, json: r } }));
  }
  openLasted() {
    const t = y;
    let e = this.DataCenter[t(194)](I.data[t(209)]);
    if (e != null) {
      let s = JSON.parse(e);
      console.log("打开json", s), this.stage.fromJSON(s);
    }
    return null;
  }
  addEventListener(t, e) {
    return super.addEventListener(t, e);
  }
  [y(188)](t, e) {
    return super[y(188)](t, e);
  }
  hasListener(t) {
    return super[y(207)](t);
  }
  dblclickHandler(t) {
    const e = y;
    this.editorEventManager[e(174)](t), this.update();
  }
  wheelHandler(t) {
    const e = y;
    this[e(229)][e(218)](t), this.update();
  }
  [y(214)](t) {
    this.editorEventManager.pointerdownHandler(t), this.update();
  }
  [y(211)](t) {
    const e = y;
    this.editorEventManager.pointupHandler(t), this[e(201)]();
  }
  [y(227)](t) {
    this.editorEventManager._dragHandler(t), this.update(), this.pointerCrossLineManager.updateGuildLine();
  }
  pointermoveHandler(t) {
    const e = y;
    if (this.stage.inputSystem[e(223)])
      return this._dragHandler(t);
    this.editorEventManager.pointermoveHandler(t), this.controlTarget && this.stage.handlerLayer[e(201)](), this.pointerCrossLineManager[e(178)]();
  }
  pointerenterHandler(t) {
    const e = y;
    this[e(229)][e(200)](t), this.update();
  }
  pointeroutHandler(t) {
    const e = y;
    this[e(229)].pointeroutHandler(t), this[e(201)]();
  }
  selectedGroupDragHandler(t, e) {
    this.editorEventManager.selectedGroupDragHandler(t, e);
  }
  [y(232)](t, e) {
    this.editorEventManager.selectedGroupDragEndHandler(t, e);
  }
  recordInterrupt() {
    const t = y;
    this.recordName != null && this.recordEnd(this[t(172)]), this[t(172)] = null, this.lastLayerState = null;
  }
  [y(225)](t) {
    const e = y;
    let s = this.getCurrentLayer(), i = s.stage[e(199)];
    this[e(172)], this[e(172)] = t, this.lastLayerState = i[e(176)](s, this.existObjectMap);
  }
  recordEnd(t) {
    const e = y;
    this.recordName, this.recordName = null;
    const s = this.existObjectMap;
    let i = this.getCurrentLayer(), o = i.stage.serializerSystem, r = this[e(204)], a = o[e(176)](i, s);
    this[e(173)].push(t, function() {
      o[e(192)](a, s);
    }, function() {
      o._restoreFromState(r, s);
    });
  }
  [y(201)]() {
    const t = y;
    this.dropToBox[t(201)](), this[t(205)][t(201)](), this.linkCtrlBox.update(), this[t(179)].update();
  }
  openJson(t) {
    const e = y;
    this.stage[e(190)](t), this[e(164)](new M("open", { details: { json: t } }));
  }
  showTip(t, e = "") {
    const s = y;
    let i = new Event("log");
    i.msg = t + e, this[s(164)](i);
  }
  create(t) {
    return this[y(181)].create(t);
  }
  mockDrop(t) {
    const e = y, s = t.changedTouches[0], i = this.stage[e(198)][e(184)].canvas[e(220)](), o = s.clientX - i[e(221)], r = s.clientY - i[e(168)];
    this[e(196)].inputSystem.x = o, this[e(196)].inputSystem.y = r, this.dispatchEvent(new PointerEvent(e(197)));
  }
  clearCtrlBoxs() {
    const t = y;
    this.connectBox.clearTarget(), this[t(205)].clearTarget(), this.linkCtrlBox.clearTarget();
  }
  toogleLocalView() {
    const t = y;
    let e = this.stage.inputSystem.target;
    e === this.stage.camera[t(189)].object ? this[t(196)].camera[t(189)].quit() : this.stage[t(169)].localView.enter(e);
  }
  sendKey(t, e) {
    this.keyboard.sendKey(t, e);
  }
  onEsc() {
    this.connectBox.cancel();
  }
  [y(213)](t, e) {
    const s = y;
    e ? this._disableEditMap.delete(t) : this._disableEditMap[s(210)](t, !0);
  }
  setConnectable(t, e) {
    const s = y;
    e ? this._disableConnectMap[s(216)](t) : this._disableConnectMap.set(t, !0);
  }
  [y(161)](t) {
    const e = y;
    return t != null && this._disableEditMap.get(t) == null && !!J.isUpdateMatrixed(t) && (!(t.parent instanceof x) || t !== t.parent.label && t !== t.parent.beginArrow && t !== t[e(166)].endArrow);
  }
  [y(182)](t) {
    if (t == null || !t.visible || !t.pointerEnabled)
      return !1;
    let e = t.parent;
    return (!(e instanceof x) || t !== e.label && e.beginArrow !== t && e.endArrow !== t) && this._disableConnectMap.get(t) == null;
  }
  getEditInfo(t, e) {
    const s = y;
    let i = { disableEdit: [], disableConnect: [] };
    for (let o = 0; o < t.length; o++) {
      let r = t[o], a = e.get(r);
      !this.isEditable(r) && a != null && i.disableEdit[s(212)](a), !this.isConnectable(r) && a != null && i.disableConnect.push(a);
    }
    return i.disableEdit.length == 0 && delete i.disableEdit, i.disableConnect.length == 0 && delete i.disableConnect, i[s(191)] || i.disableConnect ? i : null;
  }
  fromEditInfo(t, e) {
    if (t.disableEdit != null)
      for (let s = 0; s < t.disableEdit.length; s++) {
        let i = e[t.disableEdit[s]];
        this.setEditable(i, !1);
      }
    if (t.disableConnect != null)
      for (let s = 0; s < t.disableConnect.length; s++) {
        let i = e[t.disableConnect[s]];
        this.setConnectable(i, !1);
      }
  }
}
function Se(n, t) {
  var e = le();
  return (Se = function(s, i) {
    return e[s -= 442];
  })(n, t);
}
function le() {
  var n = ["93535WjsouM", "8130FpYQzh", "4674312AmpbpI", "3104530OnsUGx", "2041670syLhbo", "693VWldYc", "6116tBxyie", "1122432yWuNRr", "1526CgteMX", "10PHAfWY"];
  return (le = function() {
    return n;
  })();
}
tn.KeysConfig = ut, function() {
  for (var n = Se, t = le(); ; )
    try {
      if (parseInt(n(449)) / 1 * (parseInt(n(448)) / 2) + -parseInt(n(444)) / 3 * (parseInt(n(445)) / 4) + -parseInt(n(442)) / 5 + -parseInt(n(450)) / 6 * (-parseInt(n(447)) / 7) + -parseInt(n(446)) / 8 + parseInt(n(451)) / 9 + parseInt(n(443)) / 10 === 372191)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
}();
export {
  tn as Editor,
  sn as IconsPanel,
  rn as PropertiesPanel
};
